---
title: "request"
description: "Sends a structured HTTP request on a worker and resumes with a response."
---

```lua
request(options: HttpRequest): HttpResponse | string
```

---

## Aliases

- `http_request`
- `http.request`

---

## Arguments

<ParamField body="options" type="HttpRequest" required>
  An HttpRequest table containing Url, Method, Headers, Cookies, and Body. See Related types.
</ParamField>

---

## Returns

<ResponseField name="response" type="HttpResponse | string">
  An HttpResponse table, or a diagnostic string on transport failure.
</ResponseField>

Validation failures raise; transport failures may return a string. Non-2xx HTTP responses still return a table. See the request/response schema below.

**Related types:** [HTTP types & behavior](/reference/http/types).

---

## Example

```lua
local ok, response = pcall(request, {Url = "https://example.com", Method = "GET"})
if not ok or type(response) ~= "table" then
    warn(response)
elseif response.Success then
    print(response.StatusCode, response.Body:sub(1, 80))
else
    warn(response.StatusCode, response.StatusMessage)
end
```
