Fixes issue #577, syntax error in JSONP response

This commit is contained in:
DennisOSRM 2013-02-01 13:21:12 +01:00
parent adf0c726ef
commit 78c92be14b
2 changed files with 4 additions and 5 deletions

View File

@ -52,12 +52,12 @@ public:
//query to helpdesk //query to helpdesk
_Coordinate result; _Coordinate result;
std::string JSONParameter, tmp; std::string tmp;
//json //json
// JSONParameter = routeParameters.options.Find("jsonp"); // JSONParameter = routeParameters.options.Find("jsonp");
if("" != routeParameters.jsonpParameter) { if("" != routeParameters.jsonpParameter) {
reply.content += JSONParameter; reply.content += routeParameters.jsonpParameter;
reply.content += "("; reply.content += "(";
} }
reply.status = http::Reply::ok; reply.status = http::Reply::ok;
@ -82,7 +82,7 @@ public:
reply.content += ",\"transactionId\": \"OSRM Routing Engine JSON Locate (v0.3)\""; reply.content += ",\"transactionId\": \"OSRM Routing Engine JSON Locate (v0.3)\"";
reply.content += ("}"); reply.content += ("}");
reply.headers.resize(3); reply.headers.resize(3);
if("" != JSONParameter) { if("" != routeParameters.jsonpParameter) {
reply.content += ")"; reply.content += ")";
reply.headers[1].name = "Content-Type"; reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript"; reply.headers[1].value = "text/javascript";

View File

@ -60,7 +60,6 @@ public:
nodeHelpDesk->FindPhantomNodeForCoordinate(routeParameters.coordinates[0], result, routeParameters.zoomLevel); nodeHelpDesk->FindPhantomNodeForCoordinate(routeParameters.coordinates[0], result, routeParameters.zoomLevel);
std::string tmp; std::string tmp;
std::string JSONParameter;
//json //json
if("" != routeParameters.jsonpParameter) { if("" != routeParameters.jsonpParameter) {
@ -93,7 +92,7 @@ public:
reply.content += ",\"transactionId\":\"OSRM Routing Engine JSON Nearest (v0.3)\""; reply.content += ",\"transactionId\":\"OSRM Routing Engine JSON Nearest (v0.3)\"";
reply.content += ("}"); reply.content += ("}");
reply.headers.resize(3); reply.headers.resize(3);
if("" != JSONParameter) { if("" != routeParameters.jsonpParameter) {
reply.content += ")"; reply.content += ")";
reply.headers[1].name = "Content-Type"; reply.headers[1].name = "Content-Type";
reply.headers[1].value = "text/javascript"; reply.headers[1].value = "text/javascript";