Hi,
I have a generated rest interface and some functions should accept POST data.
This is a part of my interface:
Json getJson(HTTPServerRequest req, HTTPServerResponse res)
{
return req.json;
}
interface IRESTApi
{
@method(HTTPMethod.POST)
@path("/rest/job/:id/configure/")
@before!getJson("data")
@property Json configureJob(string _id, Json data);
}
According to documentation, HTTPServerRequest.json should contain the parsed Json of a JSON request. How does such a JSON request looks like? I tried to send it in many possible forms but the json is always undefined.
I've tried variations of this:
$.ajax({
type: "POST",
url: addr,
data: JSON.stringify({"hello":"world"}),
dataType: "json"
})
and this
$.ajax({
type: "POST",
url: addr,
data: {"hello":"world"},
dataType: "json"
})
but to no awail.
Any help is appreciated.
Thanks,
Drasha