Syntax
HttpPost(context: any, url: string, body?: string, contentTypeOrCompatibility?: string | number | boolean, headersOrContentType?: table | string, headers?: table): stringArguments
| Name | Type | Description |
|---|---|---|
context | any | Self or context argument supplied when calling method-style helpers. |
url | string | HTTP or WebSocket URL to connect to. |
body? | string | Request body sent with the HTTP request. |
contentTypeOrCompatibility? | string | number | boolean | Content type or compatibility flag for legacy HttpPost signatures. |
headersOrContentType? | table | string | Headers table or content type value, depending on the calling style. |
headers? | table | HTTP headers sent with the request. |
Returns
| Name | Type | Description |
|---|---|---|
body | string | HTTP response body. |
Description
Sends a POST request and returns the response body.
Call it with 6 parameter(s): context, url, body, contentTypeOrCompatibility, headersOrContentType, headers. The argument table explains which values are required and which ones only refine the behavior.
It returns body (string). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = HttpPost(nil, "example", "example", "example", "example", {})
print(result)