http.Request
Options table for http.client.request function.
Fields
| Name | Type | Description |
|---|---|---|
method | http.RequestMethod | nil | Request method. |
url | http.RequestURL | URL | Request URL. |
parameters | http.Parameters | URL.SearchParams | nil | KeyValue table for parameters.
Appended to the URL query for GET, HEAD and OPTIONS,
or sent as an application/x-www-form-urlencoded body for other methods (unless body is set,
any other content_type is an error).
URL.SearchParams keep repeated names and their order, plain tables are sorted by name
and pairs with non-string names or values are skipped. |
body | string? | Body string for POST data. If set, will override parameters. |
json | json.Value | nil | A value serialized as the JSON body, cannot be used together with body.
Sets content_type to "application/json; charset=utf-8" unless it is given. |
content_type | http.ContentType | nil | Content type for body. = "text/plain; charset=utf-8" |
headers | http.RequestHeaders | nil | KeyValue table for headers. |
timeout | number | nil | The timeout for the connection in seconds.
Defaults to the dreamwork_http_timeout console variable, set by http client timeout (60 seconds).
0 means no timeout.
The request also fails on the Lua side one second after the timeout,
so a client that never calls back can't hang the coroutine. = 10 |
cache | boolean | nil | Whether to cache the Response. = false |
cache_ttl | number | nil | The cache time to live for the Request. |
etag | boolean | nil | Whether to use ETag caching, only applies to GET requests. = false |
auth | http.Auth | nil | The credentials sent as the Authorization header, unless it is already in headers. |
cookies | http.CookieJar | nil | The cookie jar, matching cookies are sent in the Cookie header
(after the one from headers) and set-cookie from the response is stored in it.
Cookies set by redirect responses are only stored with chttp, where redirects are followed in Lua,
reqwest and HTTP follow redirects on their own. reqwest also passes only the last Set-Cookie header. |
max_redirects | integer | nil | The most redirects followed in Lua, more fail the request with "too many redirects".
Defaults to the dreamwork_http_max_redirects console variable, set by http client max_redirects (10 redirects).
Only applies when redirects are followed in Lua, with cookies and the chttp client,
other clients follow redirects on their own with their own limits. = 10 |