dreamworkAPI
Ctrl K
GitHub
typeDocs / http / Request

http.Request

typesource

Options table for http.client.request function.

Fields

NameTypeDescription
methodhttp.RequestMethod | nilRequest method.
urlhttp.RequestURL | URLRequest URL.
parametershttp.Parameters | URL.SearchParams | nilKeyValue 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.
bodystring?Body string for POST data. If set, will override parameters.
jsonjson.Value | nilA 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_typehttp.ContentType | nilContent type for body. = "text/plain; charset=utf-8"
headershttp.RequestHeaders | nilKeyValue table for headers.
timeoutnumber | nilThe 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
cacheboolean | nilWhether to cache the Response. = false
cache_ttlnumber | nilThe cache time to live for the Request.
etagboolean | nilWhether to use ETag caching, only applies to GET requests. = false
authhttp.Auth | nilThe credentials sent as the Authorization header, unless it is already in headers.
cookieshttp.CookieJar | nilThe 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_redirectsinteger | nilThe 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
Generated from the dreamwork meta branch.