Skip to content

Commit

Permalink
add webservice
Browse files Browse the repository at this point in the history
  • Loading branch information
cyshi committed Dec 13, 2015
1 parent df9c185 commit 9e16d75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/sofa/pbrpc/web_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,15 @@ bool WebService::DefaultService(const HTTPRequest& request,
return false;
}
std::ostringstream oss;
if (request.query_params.find("name") == request.query_params.end())
typedef std::map<std::string, std::string> QueryParams;
QueryParams::const_iterator it = request.query_params.find("name");
if (it == request.query_params.end())
{
ErrorPage(oss, "Lack of name param");
response.content = oss.str();
return true;
}
const std::string& name = request.query_params.find("name")->second;
const std::string& name = it->second;
ServiceBoard* svc_board = service_pool->FindService(name);
if (svc_board == NULL)
{
Expand Down

0 comments on commit 9e16d75

Please sign in to comment.