Modern Lua Plugins: fix errors in mods/lord/Core/http. LG-1980
This commit is contained in:
@@ -11,16 +11,16 @@ local HTTPApiTable = {}
|
|||||||
---
|
---
|
||||||
--- @param request HTTPRequest
|
--- @param request HTTPRequest
|
||||||
--- @param callback fun(result:HTTPRequestResult)
|
--- @param callback fun(result:HTTPRequestResult)
|
||||||
function HTTPApiTable:fetch(request, callback) end
|
function HTTPApiTable.fetch(request, callback) end
|
||||||
|
|
||||||
--- Performs given request asynchronously and returns handle for `HTTPApiTable.fetch_async_get()`.
|
--- Performs given request asynchronously and returns handle for `HTTPApiTable.fetch_async_get()`.
|
||||||
---
|
---
|
||||||
--- @param request HTTPRequest
|
--- @param request HTTPRequest
|
||||||
--- @return HTTPRequestHandle
|
--- @return HTTPRequestHandle
|
||||||
function HTTPApiTable:fetch_async(request) end
|
function HTTPApiTable.fetch_async(request) end
|
||||||
--- Return response data for given asynchronous HTTP request.
|
--- Return response data for given asynchronous HTTP request.
|
||||||
---
|
---
|
||||||
--- @param handle HTTPRequestHandle
|
--- @param handle HTTPRequestHandle
|
||||||
--- @return HTTPRequestResult
|
--- @return HTTPRequestResult
|
||||||
function HTTPApiTable:fetch_async_get(handle) end
|
function HTTPApiTable.fetch_async_get(handle) end
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
--- Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
|
--- Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
|
||||||
---@class HTTPRequest: table
|
---@class HTTPRequest: table
|
||||||
local HTTPRequest = {
|
local HTTPRequest = {
|
||||||
---@type string
|
---@type string? @The URL to fetch. [required]
|
||||||
url = "http://example.org",
|
url = "http://example.org",
|
||||||
|
|
||||||
---@type number @Timeout for request to be completed in seconds. Default depends on engine settings.
|
---@type number? @Timeout for request to be completed in seconds. Default depends on engine settings.
|
||||||
timeout = 10,
|
timeout = 10,
|
||||||
|
|
||||||
---@type string @`"GET"`, `"POST"`, `"PUT"` or `"DELETE"`. The http method to use. Defaults to "GET".
|
---@type string? @`"GET"`, `"POST"`, `"PUT"` or `"DELETE"`. The http method to use. Defaults to "GET".
|
||||||
method = "GET",
|
method = "GET",
|
||||||
|
|
||||||
--- Data for the POST, PUT or DELETE request.
|
--- Data for the POST, PUT or DELETE request.
|
||||||
--- Accepts both a string and a table. If a table is specified, encodes
|
--- Accepts both a string and a table. If a table is specified, encodes
|
||||||
--- table as x-www-form-urlencoded key-value pairs.
|
--- table as x-www-form-urlencoded key-value pairs.
|
||||||
---@type string|table @`"Raw request data string"` or `{field1 = "data1", field2 = "data2"}`
|
---@type (string|table)? @`"Raw request data string"` or `{field1 = "data1", field2 = "data2"}`
|
||||||
data = "example raw request",
|
data = "example raw request",
|
||||||
|
|
||||||
---@type string? @Optional, if specified replaces the default minetest user agent with given string
|
---@type string? @Optional, if specified replaces the default minetest user agent with given string
|
||||||
@@ -23,9 +23,9 @@ local HTTPRequest = {
|
|||||||
--- header strings follow HTTP specification (`"Key: Value"`).
|
--- header strings follow HTTP specification (`"Key: Value"`).
|
||||||
extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" },
|
extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" },
|
||||||
|
|
||||||
---@type boolean? @Optional, if true performs a multipart HTTP request.
|
|
||||||
--- Default is false.
|
--- Default is false.
|
||||||
--- Post only, data must be array
|
--- Post only, data must be array
|
||||||
|
---@type boolean? @Optional, if true performs a multipart HTTP request.
|
||||||
multipart = false,
|
multipart = false,
|
||||||
|
|
||||||
--- Deprecated, use `data` instead. Forces `method = "POST"`.
|
--- Deprecated, use `data` instead. Forces `method = "POST"`.
|
||||||
|
|||||||
Reference in New Issue
Block a user