12345678910111213141516171819202122232425262728293031 |
- ---@meta
- ---`HTTPRequest` definition
- ---------------------------
- -- Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
- ---@class mt.HTTPReqDef
- ---@field url string
- -- Timeout for request to be completed in seconds. Default depends on engine settings.
- ---@field timeout number
- -- The http method to use. Defaults to "GET".
- ---@field method "GET"|"POST"|"PUT"|"DELETE"
- -- Data for the POST, PUT or DELETE request.
- -- Accepts both a string and a table. If a table is specified, encodes
- -- table as x-www-form-urlencoded key-value pairs.
- ---@field data string|table
- -- Optional, if specified replaces the default minetest user agent with
- -- given string.
- ---@field user_agent string|nil
- -- Optional, if specified adds additional headers to the HTTP request.
- -- You must make sure that the header strings follow HTTP specification
- -- ("Key: Value").
- --
- -- Example: `{ "Accept-Language: en-us", "Accept-Charset: utf-8" }`.
- ---@field extra_headers table|nil
- -- * Optional, if true performs a multipart HTTP request.
- -- * Default is false.
- -- * Post only, data must be array.
- ---@field multipart boolean|nil
- -- Deprecated, use `data` instead. Forces `method = "POST"`.
- ---@field post_data string|table
|