Skip to content

Commit

Permalink
fix bad request error message
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisOSRM committed Dec 18, 2014
1 parent 533cf0e commit 64c5f5f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Server/RequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,17 @@ void RequestHandler::handle_request(const http::Request &req, http::Reply &reply
const std::string json_p = (route_parameters.jsonp_parameter + "(");
reply.content.insert(reply.content.end(), json_p.begin(), json_p.end());
}
routing_machine->RunQuery(route_parameters, json_result);

const auto return_code = routing_machine->RunQuery(route_parameters, json_result);
if (200 != return_code)
{
reply = http::Reply::StockReply(http::Reply::badRequest);
reply.content.clear();
json_result.values["status"] = 400;
std::string message = "Bad Request";
json_result.values["status_message"] = message;
JSON::render(reply.content, json_result);
return;
}
// set headers
reply.headers.emplace_back("Content-Length", cast::integral_to_string(reply.content.size()));
if ("gpx" == route_parameters.output_format)
Expand Down

0 comments on commit 64c5f5f

Please sign in to comment.