Atom

http.request()

Executes one HTTP request.

Signature

http.request(options)

Parameters

Required dictionary of request options above.

Returns

Dictionary with status, headers, body and effective url.

Behavior

Waits for the transfer, calling any chunk callback synchronously. HTTP error status codes are part of the returned result.

Errors

Configuration, transport, certificate, body limit or callback error.

Example

Start the HTTP server on its default loopback port before running this program.

Atom
use http
response = http.request({url = 'http://127.0.0.1:18080/greet', timeout = 5})
assert(response.status == 200)
print(response.body)