# DurableHttpResponse Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.durablehttpresponse/)

## EnsureSuccessStatusCode {#ensuresuccessstatuscode-dc2a913b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.durablehttpresponse/methods/ensuresuccessstatuscode-dc2a913b/)

[Source](https://github.com/dotnet/orleans/blob/4e887e9c914a2f2647fb3c81de963511521dd9cb/src/Orleans.Durable.Http/DurableHttpResponse.cs#L32)

```csharp
public DurableHttpResponse EnsureSuccessStatusCode()
```

Throws an `System.Net.Http.HttpRequestException` when [DurableHttpResponse](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.durablehttpresponse/) is `false`.

### Returns

This response.

### Exceptions

- `System.Net.Http.HttpRequestException`: The response doesn't have a success status code.

## GetHeader(string) {#getheader-string-4c3657bc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.durablehttpresponse/methods/getheader-string-4c3657bc/)

[Source](https://github.com/dotnet/orleans/blob/4e887e9c914a2f2647fb3c81de963511521dd9cb/src/Orleans.Durable.Http/DurableHttpResponse.cs#L37)

```csharp
public string? GetHeader(string name)
```

Returns the first value of the header `name`, or `null` when the response doesn't have it.

### Parameters

- `name` (`string`): The header's name.

### Returns

The header's first value, or `null`.

## ReadAsString {#readasstring-786cbdef}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.durablehttpresponse/methods/readasstring-786cbdef/)

[Source](https://github.com/dotnet/orleans/blob/4e887e9c914a2f2647fb3c81de963511521dd9cb/src/Orleans.Durable.Http/DurableHttpResponse.cs#L41)

```csharp
public string ReadAsString()
```

Returns the content decoded as UTF-8 text.

### Returns

The content as a string.

## ReadFromJson(JsonSerializerOptions?) {#readfromjson-1-system-text-json-jsonserializeroptions-nullable-582d3669}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.durablehttpresponse/methods/readfromjson-1-system-text-json-jsonserializeroptions-nullable-582d3669/)

[Source](https://github.com/dotnet/orleans/blob/4e887e9c914a2f2647fb3c81de963511521dd9cb/src/Orleans.Durable.Http/DurableHttpResponse.cs#L48)

```csharp
public T? ReadFromJson<T>(JsonSerializerOptions? options = null)
```

Deserializes the content as JSON, or returns `default` for empty content.

### Parameters

- `options` (`JsonSerializerOptions?`): The serializer options, or `null` for the `System.Text.Json.JsonSerializerDefaults.Web` defaults.

### Returns

The deserialized value.
