Input data format: JSON.
-Output data formats: JSON, JSONP
-
-All GET requests support appending a `_callback` URL parameter, which, if
-present, will turn the response into a JSONP response.
+Output data formats: JSON.
The `Accept:` header determines the output format. An unknown value or
`*/*` will cause a `400 Bad Request`.
resp->headers["X-XSS-Protection"] = "1; mode=block";
resp->headers["Content-Security-Policy"] = "default-src 'self'; style-src 'self' 'unsafe-inline'";
- string callback;
-
- if(req->getvars.count("callback")) {
- callback=req->getvars["callback"];
- req->getvars.erase("callback");
- }
-
req->getvars.erase("_"); // jQuery cache buster
try {
// No Content -> no Content-Type.
resp->headers.erase("Content-Type");
}
-
- if(!callback.empty()) {
- resp->body = callback + "(" + resp->body + ");";
- }
}
void WebServer::registerApiHandler(const string& url, HandlerFunction handler) {