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

Seb via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 9 07:30:21 PDT 2016


On Tuesday, 9 August 2016 at 14:07:48 UTC, Joseph Rushton 
Wakeling wrote:
> 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

There is also

https://github.com/ikod/dlang-requests

Which I find in general more intuitive to use ;-)



More information about the Digitalmars-d-learn mailing list