Skip to main content

http.post(url, headers, body)

Returns a new HTTP POST request object

Availability

Agent

Parameters

Name Type Description
url String The URL to which the HTTP request will be made
headers Table Optional table of additional HTTP headers
body String or blob The body of the HTTP request

Returns

An httprequest object

Description

This method returns an httprequest object primed to make an HTTP/1.1 POST request to the specified URL. The request isn’t issued until either sendsync() or sendasync() is called on the returned httprequest object.

The URL must start with "http://" or "https://" — ie. it must include the colon and the double-slash.

The headers can be any supported by HTTP, for instance:

{ "Content-Type" : "text/xml" }

Note Headers are specified without the colon.

The request body can be any string, but most servers will expect its content type to be as described by the Content-Type header.