Function writeFormBody

Writes a vibe.http.client.HTTPClientRequest body as URL encoded form data.

Prototype

void writeFormBody(
  HTTPClientRequest req,
  const(string[string]) form
);

Example

import vibe.core.log;
import vibe.http.client;
import vibe.http.form;
import vibe.stream.operations;

void sendForm()
{
	requestHTTP("http://example.com/form",
		(scope req) {
			req.method = HTTPMethod.POST;
			req.writeFormBody(["field1": "value1", "field2": "value2"]);
		},
		(scope res) {
			logInfo("Response: %s", res.bodyReader.readAllUTF8());
		});
}

Authors

Sönke Ludwig, Jan Krüger

Copyright

© 2012 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.