# Interface: http

> Outbound HTTPS to hosts in the bot's `network` grant. The request leaves from the host, so the remote server learns the host's address.  The `local_network` grant adds exact `host:port` addresses next

Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit.

Outbound HTTPS to hosts in the bot's `network` grant. The request leaves from the host,
so the remote server learns the host's address.

The `local_network` grant adds exact `host:port` addresses next to the host (a media
server on the same machine, say), reached over `http://` or `https://`. Only those
addresses skip the private-address refusal; the operator's ceiling decides whether any
may be granted.

## Functions

### `fetch`

```wit
fetch: func(req: request) -> result<response, http-error>;
```

## Types

### `request`

*record*

| Member | Description |
|---|---|
| `method: string` |  |
| `url: string` |  |
| `headers: list<tuple<string, string>>` |  |
| `body: option<list<u8>>` |  |
| `timeout-ms: option<u32>` |  |

### `response`

*record*

| Member | Description |
|---|---|
| `status: u16` |  |
| `headers: list<tuple<string` |  |
| `string>>` |  |
| `body: list<u8>` |  |

### `http-error`

*variant*

| Member | Description |
|---|---|
| `not-granted(string)` | The host (or `host:port`) is not in the bot's `network` or `local_network` grant, or not in the operator's ceiling. |
| `refused-address` | The name resolved to a loopback, private, link-local or reserved address, and the address is not a `local_network` grant. |
| `invalid-url` | Malformed, or not `https://` (`http://` only for `local_network` addresses). |
| `timeout` |  |
| `too-large` |  |
| `transport(string)` |  |
