The OpenD Programming Language

HTTP.setPostData

Specify data to post when not using the onSend callback, with user-specified Content-Type.

struct HTTP
void
setPostData
(
const(void)[] data
,)

Parameters

data const(void)[]

Data to post.

contentType string

MIME type of the data, for example, "text/plain" or "application/octet-stream". See also: Internet media type on Wikipedia.

import std.net.curl;
auto http = HTTP("http://onlineform.example.com");
auto data = "app=login&username=bob&password=s00perS3kret";
http.setPostData(data, "application/x-www-form-urlencoded");
http.onReceive = (ubyte[] data) { return data.length; };
http.perform();

Meta