Yuari
Documentation
Docs/HTTP/httppost

httppost

POST with an optional content type (default "application/json").

Syntax

httppost(url: string, body: string, contentType?: string, headers?: table) -> string

Parameters

ParameterTypeDescription
urlstringThe target URL.
bodystringThe request body to send.
contentType?stringThe content type value used by the call.
headers?tableA table of request headers.

Returns

TypeDescription
stringBody

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.