# Response interface · @imqueue/http-protect

Source: https://imqueue.org/api/http-protect/latest/http-protect.response/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/http-protect 3.0.1 — generated reference, not hand-written

The minimum a response object must provide for the middlewares to answer with.

**Signature:**

```typescript
export interface Response 
```

## Remarks

Structural on purpose, so express, Fastify's compatibility layer, a bare `http.ServerResponse` wrapper or a test double all satisfy it without this package depending on any of them.

[Response.header()](https://imqueue.org/api/http-protect/latest/http-protect.response.header/) and [Response.setHeader()](https://imqueue.org/api/http-protect/latest/http-protect.response.setheader/) are both optional because frameworks disagree on which they provide; [HttpProtect.textMiddleware()](https://imqueue.org/api/http-protect/latest/http-protect.httpprotect.textmiddleware/) and [HttpProtect.jsonMiddleware()](https://imqueue.org/api/http-protect/latest/http-protect.httpprotect.jsonmiddleware/) prefer `header`, fall back to `setHeader`, and simply send no `Content-Type` if neither is a function.

## Methods


| Method | Description |
| --- | --- |
| [end(args)](https://imqueue.org/api/http-protect/latest/http-protect.response.end/) | Ends the response. Called by every middleware on a rejected request, including after [Response.send()](https://imqueue.org/api/http-protect/latest/http-protect.response.send/). |
| [header(name, value)?](https://imqueue.org/api/http-protect/latest/http-protect.response.header/) | _(Optional)_ Express-style header setter, preferred when present. |
| [send(args)](https://imqueue.org/api/http-protect/latest/http-protect.response.send/) | Writes the response body. Given a plain string by [HttpProtect.textMiddleware()](https://imqueue.org/api/http-protect/latest/http-protect.httpprotect.textmiddleware/) and a JSON string by [HttpProtect.jsonMiddleware()](https://imqueue.org/api/http-protect/latest/http-protect.httpprotect.jsonmiddleware/); never called by [HttpProtect.middleware()](https://imqueue.org/api/http-protect/latest/http-protect.httpprotect.middleware/), which answers with no body at all. |
| [setHeader(name, value)?](https://imqueue.org/api/http-protect/latest/http-protect.response.setheader/) | _(Optional)_ Node-style header setter, used only when [Response.header()](https://imqueue.org/api/http-protect/latest/http-protect.response.header/) is absent. |
| [status(code)](https://imqueue.org/api/http-protect/latest/http-protect.response.status/) | Sets the HTTP status code. Called with 429 or 418 before the body is sent. |

