On Mon, 22 Sep 2014 12:27:04 GMT, David Monagle wrote:

Hi guys, tearing my hair out with this one. I'm trying to do a HTTP POST request with a JSON body. Seems straight forward and there is even an example in the Vibe docs. However the body never seems to make it through to the server. In order to make sure I wasn't doing something stupid (always a possibility) I modified the http_request example like so:

(...)

Checking the requestbin the json headers are set correctly but the RAW body is empty. Just as I am experiencing with my main project. I may just be missing something, can anybody help out please?

It sounds like the issue is on the server side. By default, the HTTPServerOption.parseJsonBody option is set in HTTPServerSettings. This causes any JSON body in a request to be read (consumed) and parsed into req.json, and req.bodyReader stream will then be empty. The solution is to clear this option:

auto settings = new HTTPServerSettings;
settings.options &= ~HTTPServerOption.parseJsonBody;
listenHTTP(settings, ...);