c_web_client
Functions
get
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
local web_client = c_web_client.new()
local response = web_client:get(
"https://example.com",
{
useragent = "useragent",
headers = {{"content-type", "application/json"}},
timeout = 30 --[[ 30 seconds --]]
}
)
local json_table = response:json()
async_get
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |
local web_client = c_web_client.new()
web_client:async_get("https://example.com", {}, function(response)
local json_table = response:json()
end)
post
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
async_post
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |
put
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
async_put
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |
delete
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
async_delete
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |
patch
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
async_patch
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |
head
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
async_head
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |
options
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
returns | c_response |
async_options
Argument | Type | Required |
---|---|---|
url | string | |
options | {timeout: number | nil, body: string | table | nil, useragent: string | nil, headers: table | nil } | |
callback | function(response: c_response) | |
returns | c_response |