Can't understand how to do server response with vibed

Sebastiaan Koppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 28 15:18:43 PST 2015


On Saturday, 28 November 2015 at 18:51:57 UTC, Suliman wrote:
> Eghm, sorry. Not req, but res, but again errr:
>
> void action(HTTPServerRequest req, HTTPServerResponse res)
> {
>     writeln(req.writeJsonBody);
> }

What you want is `req.json`.

Make sure that the call from angular sets the Content-Type header 
to application/json. But I think that should happen by default.


More information about the Digitalmars-d-learn mailing list