Garry's Mod Wiki

Revision Difference

Structures/HTTPRequest#561471

<structure> <realm>Shared and Menu</realm> <description>Table used by <page>Global.HTTP</page> function.</description> <fields> <item name="failed" type="function">Function to be called on failure. Arguments are⤶ * <page>string</page> reason⤶ <item name="failed" type="function">Function to be called on failure.⤶ <callback>⤶ <arg type="string" name="reason">Reason for the failure.</arg>⤶ </callback>⤶ </item> <item name="success" type="function">Function to be called on success. Arguments are⤶ * <page>number</page> code⤶ * <page>string</page> body⤶ * <page>table</page> headers⤶ <item name="success" type="function">Function to be called on success.⤶ <callback>⤶ <arg type="number" name="code">The HTTP result code</arg>⤶ <arg type="string" name="body">The document data, usually HTML or JSON contents.</arg>⤶ <arg type="table" name="headers">List of headers the server provided.</arg>⤶ </callback>⤶ </item> <item name="method" type="string">Request method, case insensitive. Possible values are: * GET * POST * HEAD * PUT * DELETE * PATCH * OPTIONS </item> <item name="url" type="string">The target url</item> <item name="parameters" type="table">KeyValue table for parameters. This is only applicable to the following request methods: * GET * POST * HEAD </item> <item name="headers" type="table">KeyValue table for headers</item> <item name="body" type="string">Body string for POST data. If set, will override parameters</item> <item name="type" type="string" default="text/plain; charset=utf-8">Content type for body.</item> <item name="timeout" type="number" default="60">The timeout for the connection.</item> </fields> </structure>