Garry's Mod Wiki

HTTPRequest

Description

Table used by HTTP function.

Members

function failed
Function to be called on failure.
Function argument(s):
1 string reason - Reason for the failure.
function success
Function to be called on success.
Function argument(s):
1 number code - The HTTP result code
2 string body - The document data, usually HTML or JSON contents.
3 table headers - List of headers the server provided.
string method
Request method, case insensitive. Possible values are:
  • GET
  • POST
  • HEAD
  • PUT
  • DELETE
  • PATCH
  • OPTIONS
string url
The target url
table parameters
KeyValue table for parameters. This is only applicable to the following request methods:
  • GET
  • POST
  • HEAD
table headers
KeyValue table for headers
string body
Body string for POST data. If set, will override parameters
string type
Content type for body.

Default: "text/plain; charset=utf-8"

number timeout
The timeout for the connection.

Default: 60