Can't understand how to do server response with vibed

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 28 10:55:08 PST 2015


On 28.11.2015 19:46, Suliman wrote:
> And the second question. Why I am getting next error after attempt to
> write to console JSON request:
>
> Error: cannot resolve type for res.writeJsonBody(T)(T data int status =
> HTTPStatus.OK, string content_type = "application/json; charset=UF-8",
> bool allow_chunked = false)
>
> void action(HTTPServerRequest req, HTTPServerResponse res)
> {
>      writeln(res.writeJsonBody);
> }

That's because writeJsonBody's return type is void.

http://vibed.org/api/vibe.http.server/HTTPServerResponse.writeJsonBody


More information about the Digitalmars-d-learn mailing list