On Sun, 19 Jun 2016 12:20:47 GMT, Alexsey wrote:
there is an xml file with the contents of
<?xml version='1.0' encoding='UTF-8'?> <request> <seller> <id>550054</id> </seller> <category> <id>1</id> </category> <lang>en</lang> </request>
(...)
One way would be to write the file directly to the response:
import vibe.vibe;
void main()
{
auto file = openFile("test.xml", FileMode.read);
requestHTTP("http://site.com/balblabla.asp",
(scope req) {
// could add headers here before sending,
req.method = HTTPMethod.POST;
req.contentType("application/xml");
req.writeBody(file);
},
(scope res) {
logInfo("Response: %s", res.bodyReader.readAllUTF8());
}
);
}
Alternatively, the contents can be written as a string, too:
req.writeBody("<?xml version='1.0'...");
See also http://vibed.org/api/vibe.http.client/HTTPClientRequest.writeBody