Hello,
I am trying to retrieve a request body (supposed to be some json object) and I receveive some null characters. Here is a snippet :
// *method: POST
void echo (ngrest::MessageContext& context)
{
ngrest::HttpRequest* request = static_cast<ngrest::HttpRequest*> (context.request);
for (size_t i=0; i<request->bodySize; i++)
{
printf ("%d ", request->body[i]);
}
printf ("\n");
}
For instance, I send:
curl -X POST -H 'Content-Type: application/json' -i http://localhost:9098/foobar --data '{"aaa":"bbb"}'
and my 'echo' service displays:
123 34 97 97 97 0 58 34 98 98 98 0 0
I receive the correct number of characters, but there are 3 zero values that are obviously wrong.
Am I missing something ?
Thank you in advance