mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 04:52:26 +00:00
add Net.Http to lua
This commit is contained in:
@@ -21,4 +21,39 @@ Out = {
|
||||
---@field EventWarn fun(msg: string)
|
||||
|
||||
---@type Log
|
||||
Log = {}
|
||||
Log = {}
|
||||
|
||||
---@class HttpResponse
|
||||
---@field status integer HTTP status code
|
||||
---@field status_text string HTTP status text
|
||||
---@field body string Response body
|
||||
---@field content_length integer Content length
|
||||
---@field headers table<string, string|string[]> Response headers
|
||||
|
||||
---@class Http
|
||||
---@field Get fun(log: boolean, url: string): HttpResponse, string? Makes HTTP GET request
|
||||
---@field Post fun(log: boolean, url: string, content_type: string, payload: string): HttpResponse, string? Makes HTTP POST request
|
||||
|
||||
---@class Net
|
||||
---@field Http Http HTTP client methods
|
||||
|
||||
---@type Net
|
||||
Net = {
|
||||
Http = {
|
||||
---Makes HTTP GET request
|
||||
---@param log boolean Whether to log the request
|
||||
---@param url string URL to request
|
||||
---@return HttpResponse response
|
||||
---@return string? error
|
||||
Get = function(log, url) end,
|
||||
|
||||
---Makes HTTP POST request
|
||||
---@param log boolean Whether to log the request
|
||||
---@param url string URL to request
|
||||
---@param content_type string Content-Type header
|
||||
---@param payload string Request body
|
||||
---@return HttpResponse response
|
||||
---@return string? error
|
||||
Post = function(log, url, content_type, payload) end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user