std.net.curl - how to set custom Content-Type?

Dmitry Olshansky dmitry.olsh at gmail.com
Mon Sep 17 11:33:28 PDT 2012


Recently was playing around with std.net.curl high-level API.

One thing that is a blocker for me is (quoting the docs):

@property void postData(const(char)[] data);
Specifying data to post when not using the onSend callback.
...
Content-Type will default to text/plain. Data is not converted or 
encoded by this method.

Yeah, there are only 2 occurrences of Content-Type throughout the docs 
the second "defaults" to Content-Type application/octet-stream.

Say I want to send text/xml. Adding Content-Type as header via
addRequestHeader doesn't seem to change a thing (probably because it 
already has the default one).



-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list