Skip to content

DurableHttpResponse Methods

Records an HTTP response which a durable task received: its status code, headers, and content.

EnsureSuccessStatusCode

View source
public DurableHttpResponse EnsureSuccessStatusCode()
Throws an System.Net.Http.HttpRequestException when DurableHttpResponse is false.

Returns

This response.

Exceptions

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

GetHeader(string)

View source
public string? GetHeader(string name)
Returns the first value of the header name, or null when the response doesn't have it.

Parameters

namestring
The header's name.

Returns

The header's first value, or null.

ReadAsString

View source
public string ReadAsString()
Returns the content decoded as UTF-8 text.

Returns

The content as a string.

ReadFromJson(JsonSerializerOptions?)

View source
public T? ReadFromJson<T>(JsonSerializerOptions? options = null)
Deserializes the content as JSON, or returns default for empty content.

Parameters

optionsJsonSerializerOptions?
The serializer options, or null for the System.Text.Json.JsonSerializerDefaults.Web defaults.

Returns

The deserialized value.