Garry's Mod Wiki

Revision Difference

Structures/HTTPRequest#517032

<cat>struct</cat> <structure> <description>Table used by <page>Global.HTTP</page> function.</description> <fields> {{StructureField|function|failed|Function to be called on failure. Arguments are * <page>string</page> reason⤶ </fields>⤶ ⤶ </structure>⤶ ⤶ {{StructureField|function|success|Function to be called on success. Arguments are⤶ <item name="failed" type="function">Function to be called on failure. Arguments are * <page>string</page> reason</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⤶ }}{{StructureField|string|method|Request method, case insensitive. Possible values are: * <page>table</page> headers</item>⤶ <item name="method" type="string">Request method, case insensitive. Possible values are: * GET * POST * HEAD * PUT * DELETE * PATCH * OPTIONS⤶ }}{{StructureField|string|url|The target url}}{{StructureField|table|parameters|KeyValue table for parameters. This is only applicable to the following request methods:⤶ * 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⤶ }}{{StructureField|table|headers|KeyValue table for headers}}{{StructureField|string|body|Body string for POST data. If set, will override parameters}}{{StructureField|string|type|Content type for body.|"text/plain; charset&#61;utf-8"}}⤶ * 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>⤶ {{StructureField|string|type|Content type for body.|"text/plain; charset&amp;#61;utf-8"⤶ </fields>⤶ ⤶ </structure>⤶ ⤶ ⤶ }}