> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: HTTP
icon: router
---

# <ApiPageIcon icon="router" />HTTP

<ApiExposes data="[{&#x22;k&#x22;:&#x22;NAMESPACE&#x22;,&#x22;c&#x22;:&#x22;fn&#x22;,&#x22;s&#x22;:&#x22;http&#x22;,&#x22;h&#x22;:&#x22;#http-1&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;http.Response&#x22;,&#x22;h&#x22;:&#x22;#httpresponse&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;http.Authorization&#x22;,&#x22;h&#x22;:&#x22;#httpauthorization&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;h&#x22;:&#x22;#httpoptions&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;http.Cookie&#x22;,&#x22;h&#x22;:&#x22;#httpcookie&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;http.Cookies&#x22;,&#x22;h&#x22;:&#x22;#httpcookies&#x22;}]" />

<Heading level={2} id="http-1">
  http

  <ApiTag label="global table" />
</Heading>

Sends HTTP requests. Every request runs in the background, and the response is passed to
`callback` when it arrives.

Add `http` to the `requirements` in `extension.json` before you call `require("http")`.

You can leave out `options`. So `http.Get(url, callback)` and `http.Get(url, options, callback)`
both work. A value in the place of `options` that is not a table, such as `false`, counts as no
options.

A callback runs only if the script is still loaded when the response arrives. When another
script is turned on or off, or a developer script is saved, all scripts are reloaded and the
callbacks that are waiting are dropped. In that case the `shutdown` callback of the script
receives `"refresh"` or `"reload"`, and the script can send the request again.

A script can have at most 64 requests that have not finished. Past that, a new request throws
an error and is not sent.

A header name that is not a string throws an error. A header name or value that contains CR, LF
or NUL also throws an error. An option key that is not listed in `http.Options` is ignored, and
the request is still sent. In a developer script, an unknown key also adds a warning to the
errors of the script, once for each key.

Redirects are followed. Only the `http` and `https` schemes are allowed. Certificates are always
checked.

Market scripts cannot send requests to the computer of the user or to a private network. Such
requests fail with the `"blocked"` error.

<ApiMembers>
  <ApiMember kind="fn" name="http.Get" summary="Sends a `GET` request." args="url, options?, callback" sig="[{&#x22;s&#x22;:&#x22;http.Get&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;url&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;options&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;callback&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;url&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The URL of the request.&#x22;},{&#x22;n&#x22;:&#x22;options&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;}],&#x22;d&#x22;:&#x22;The options of the request.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;callback&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;}],&#x22;d&#x22;:&#x22;The function that receives the response when the request is finished.&#x22;}]" />

  <ApiMember kind="fn" name="http.Head" summary="Sends a `HEAD` request. The server returns only the headers, so the body of the response is empty." args="url, options?, callback" sig="[{&#x22;s&#x22;:&#x22;http.Head&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;url&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;options&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;callback&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;url&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The URL of the request.&#x22;},{&#x22;n&#x22;:&#x22;options&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;}],&#x22;d&#x22;:&#x22;The options of the request.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;callback&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;}],&#x22;d&#x22;:&#x22;The function that receives the response when the request is finished.&#x22;}]" />

  <ApiMember kind="fn" name="http.Post" summary="Sends a `POST` request." args="url, options?, callback" sig="[{&#x22;s&#x22;:&#x22;http.Post&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;url&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;options&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;callback&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;url&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The URL of the request.&#x22;},{&#x22;n&#x22;:&#x22;options&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;}],&#x22;d&#x22;:&#x22;The options of the request.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;callback&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;}],&#x22;d&#x22;:&#x22;The function that receives the response when the request is finished.&#x22;}]" />

  <ApiMember kind="fn" name="http.Put" summary="Sends a `PUT` request." args="url, options?, callback" sig="[{&#x22;s&#x22;:&#x22;http.Put&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;url&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;options&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;callback&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;url&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The URL of the request.&#x22;},{&#x22;n&#x22;:&#x22;options&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;}],&#x22;d&#x22;:&#x22;The options of the request.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;callback&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;}],&#x22;d&#x22;:&#x22;The function that receives the response when the request is finished.&#x22;}]" />

  <ApiMember kind="fn" name="http.Delete" summary="Sends a `DELETE` request." args="url, options?, callback" sig="[{&#x22;s&#x22;:&#x22;http.Delete&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;url&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;options&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;callback&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;url&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The URL of the request.&#x22;},{&#x22;n&#x22;:&#x22;options&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;}],&#x22;d&#x22;:&#x22;The options of the request.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;callback&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;}],&#x22;d&#x22;:&#x22;The function that receives the response when the request is finished.&#x22;}]" />

  <ApiMember kind="fn" name="http.Patch" summary="Sends a `PATCH` request." args="url, options?, callback" sig="[{&#x22;s&#x22;:&#x22;http.Patch&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;url&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;options&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;callback&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;url&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The URL of the request.&#x22;},{&#x22;n&#x22;:&#x22;options&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Options&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpoptions&#x22;}],&#x22;d&#x22;:&#x22;The options of the request.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;callback&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Callback&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Callback&#x22;}],&#x22;d&#x22;:&#x22;The function that receives the response when the request is finished.&#x22;}]" />

  <ApiMember kind="fn" name="http.Cookies" summary="Creates a new cookie container. Pass it in `options.cookie` of a request." args="" sig="[{&#x22;s&#x22;:&#x22;http.Cookies&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Cookies&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpcookies&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;http.Cookies&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpcookies&#x22;}]]" />

  <ApiMember kind="type" name="http.Error" summary="The reason why no response arrived." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" expand="[{&#x22;n&#x22;:&#x22;&#x22;,&#x22;values&#x22;:[[&#x22;\&#x22;blocked\&#x22;&#x22;,&#x22;&#x22;,&#x22;The address is on the computer of the user or on a private network. Market scripts cannot send requests there.&#x22;],[&#x22;\&#x22;resolve\&#x22;&#x22;,&#x22;&#x22;,&#x22;The host name could not be found.&#x22;],[&#x22;\&#x22;connect\&#x22;&#x22;,&#x22;&#x22;,&#x22;The connection to the server failed.&#x22;],[&#x22;\&#x22;timeout\&#x22;&#x22;,&#x22;&#x22;,&#x22;The request took longer than `timeout`, or the connection stalled.&#x22;],[&#x22;\&#x22;tls\&#x22;&#x22;,&#x22;&#x22;,&#x22;The secure connection failed, for example because of a bad certificate.&#x22;],[&#x22;\&#x22;too_large\&#x22;&#x22;,&#x22;&#x22;,&#x22;The body of the response was larger than 64 MB.&#x22;],[&#x22;\&#x22;bad_url\&#x22;&#x22;,&#x22;&#x22;,&#x22;The URL is not valid, or its scheme is not `http` or `https`.&#x22;],[&#x22;\&#x22;failed\&#x22;&#x22;,&#x22;&#x22;,&#x22;Any other error.&#x22;]]}]" />

  <ApiMember kind="type" name="http.Callback" ret="[[{&#x22;s&#x22;:&#x22;fun&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;response&#x22;},{&#x22;s&#x22;:&#x22;:&#x22;},{&#x22;s&#x22;:&#x22; &#x22;},{&#x22;s&#x22;:&#x22;http.Response&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpresponse&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;response&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Response&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpresponse&#x22;}]}]" />
</ApiMembers>

## http.Response<ApiTag label="object type" />

The response to a request. `status` is `0` only when `error` is set. An HTTP error status such
as `404` is still a response, so `error` is `nil` for it.

<ApiMembers>
  <ApiMember kind="prop" name="http.Response.body" summary="The body of the response." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />

  <ApiMember kind="prop" name="http.Response.error" summary="The reason why no response arrived. It is `nil` when a response arrived." ret="[[{&#x22;s&#x22;:&#x22;http.Error&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#http-Error&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Response.status" summary="The HTTP status code. It is `0` when no response arrived." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />
</ApiMembers>

## http.Authorization<ApiTag label="object type" />

<ApiMembers>
  <ApiMember kind="prop" name="http.Authorization.password" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />

  <ApiMember kind="prop" name="http.Authorization.username" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />
</ApiMembers>

## http.Options<ApiTag label="object type" />

<ApiMembers>
  <ApiMember kind="prop" name="http.Options.authorization" summary="The user name and password for HTTP authentication." ret="[[{&#x22;s&#x22;:&#x22;http.Authorization&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpauthorization&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Options.cookie" summary="A cookie container. Its cookies are sent with the request, and the cookies from the response are added to it." ret="[[{&#x22;s&#x22;:&#x22;http.Cookies&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpcookies&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Options.headers" summary="The request headers, with header names as keys." ret="[[{&#x22;s&#x22;:&#x22;table&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/table#table-1&#x22;},{&#x22;s&#x22;:&#x22;\u003c&#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;,&#x22;},{&#x22;s&#x22;:&#x22; &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;\u003e&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Options.json" summary="A JSON string to send as the body. It sets the `Content-Type: application/json` header. When `json` is set, `params` is ignored." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Options.params" summary="The parameters, as a table of names and values or as a string that is already encoded. For `POST`, `PUT` and `PATCH` they are sent in the body as form data. For other methods they are added to the query string of the URL. A string that contains CR, LF or NUL throws an error." ret="[[{&#x22;s&#x22;:&#x22;table&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/table#table-1&#x22;},{&#x22;s&#x22;:&#x22;\u003c&#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;,&#x22;},{&#x22;s&#x22;:&#x22; &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;\u003e&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Options.timeout" summary="The time limit for the whole request, in seconds. The default is `30`. The value is clamped to the range from `1` to `300`." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />
</ApiMembers>

## http.Cookie<ApiTag label="object type" />

<ApiMembers>
  <ApiMember kind="prop" name="http.Cookie.expire" summary="The time the cookie expires, as a Unix timestamp in seconds." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Cookie.host" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />

  <ApiMember kind="prop" name="http.Cookie.name" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />

  <ApiMember kind="prop" name="http.Cookie.path" summary="The path of the cookie. The default is `&#x22;/&#x22;`." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Cookie.secure" summary="`true` to send the cookie only over HTTPS." ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Cookie.subdomains" summary="`true` to also send the cookie to subdomains of `host`." ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="http.Cookie.value" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />
</ApiMembers>

## http.Cookies<ApiTag label="object type" />

A container for cookies. It holds cookies to send with requests, and it collects the cookies
that servers return. Use the same container for several requests to keep the cookies between
them. Create a container with `http.Cookies`.

<ApiMembers>
  <ApiMember kind="method" name="http.Cookies:Set" summary="Adds a cookie to the container. If `expire` is `0`, the cookie is a session cookie." args="cookie" sig="[{&#x22;s&#x22;:&#x22;http.Cookies:Set&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;cookie&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;http.Cookie&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpcookie&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;cookie&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;http.Cookie&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/networking/http#httpcookie&#x22;}],&#x22;d&#x22;:&#x22;The cookie to add.&#x22;}]">
    <ApiNotes>
      Throws an error if a string field contains CR, LF, NUL or TAB.
    </ApiNotes>
  </ApiMember>
</ApiMembers>
