Specifying content-type for a POST request using std.net.curl

Joseph Rushton Wakeling via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 9 07:07:48 PDT 2016


Hello all,

I'm currently writing a little client app whose job is to make a 
POST request to a vibe.d webserver and output the response.  
However, vibe.d is picky about the content-type of the request 
body, and so far as I can see there is no way to specify this via 
the `std.net.curl.post` API.

So far as I can see from the vibe.d log output, `post` is using 
the `text/plain` content type, to which vibe.d objects (rightly) 
because the content is not UTF8.  It's a little bizarre that 
`text/plain` is chosen, because the input data is `void[]` or 
`ubyte[]` data.

Can anyone advise (if it's possible at all) how to specify the 
content type for the post request body using std.net.curl (or an 
alternative)?

Thanks & best wishes,

     -- Joe


More information about the Digitalmars-d-learn mailing list