---
title: "Response class"
canonical: https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response
---

# Response class

The HTTP response an [`HttpHandlerAttribute`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/HttpHandlerAttribute) method returns.

```csharp
public sealed class Response
```

## Public Members

| name                                                                                              | description                                                                                                           |
| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| static [Bytes](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Bytes)(…)   | Creates a response from bytes with the content type you name, such as `image/png`.                                    |
| static [Http](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Http)(…)     | Creates a response with exactly the status, body and headers you give it.                                             |
| static [Json](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Json)(…)     | Creates a JSON response from text that is already JSON, sent as UTF-8 with the content type `application/json`.       |
| static [Raw](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Raw)(…)       | Creates a response from bytes, sent without a content type.                                                           |
| static [Text](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Text)(…)     | Creates a plain-text response, sent as UTF-8 with the content type `text/plain; charset=utf-8`.                       |
| static [Stream](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Stream)(…) | Starts a response whose body is sent in pieces as the handler produces them, and returns the writer for those pieces. |

## Remarks

Create one with the static method that fits what you are sending:

- [`Text`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Text) for plain text.
- [`Json`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Json) for JSON you have already serialized to a string.
- [`Bytes`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Bytes) for binary content with a content type, such as an image.
- [`Raw`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Raw) for bytes sent without a content type.
- [`Http`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Http) to choose every header yourself, as a redirect or a cookie needs.
- [`Stream`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Stream) to send the body in pieces as it is produced, instead of building it all first.

[`Bytes`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Bytes), [`Raw`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Raw) and [`Http`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Response/Http) keep the array they are given rather than copying it, so do not change it after the call.

An ordinary unhandled handler exception produces status 500 if the response has not started, or aborts it otherwise. Returning a response whose status is below 200 or whose headers are not valid HTTP produces status 502.

An ASP.NET application does not use this type: it writes to `HttpContext.Response` as usual.

## See Also

- namespace [Isoplane](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk)
