httppost
POST with an optional content type (default "application/json").
Syntax
httppost(url: string, body: string, contentType?: string, headers?: table) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The target URL. |
body | string | The request body to send. |
contentType? | string | The content type value used by the call. |
headers? | table | A table of request headers. |
Returns
| Type | Description |
|---|---|
string | Body |
Description
httppost is part of the HTTP library. HTTP functions use the external WinHTTP client and return the raw response body or response table.
The operation is performed immediately using the arguments supplied at the call site.
Example
local body = httppost("https://httpbin.org/post", '{"name":"yuari"}', "application/json")
print(body)
Notes
- HTTP requests are made through the external WinHTTP client.