Table of Contents

Class FetchResult

Namespace
DotNetDo
Assembly
DotNetDo.Core.dll

The buffered response to an HTTP request.

public sealed record FetchResult : IEquatable<FetchResult>

Properties

Body

The buffered response body, whose media type comes from the Content-Type header.

public required BinaryData Body { get; init; }

Property Value

BinaryData

Headers

Response and content headers, with case-insensitive names.

public required IReadOnlyDictionary<string, IReadOnlyList<string>> Headers { get; init; }

Property Value

IReadOnlyDictionary<string, IReadOnlyList<string>>

IsSuccessStatusCode

Whether the status code is in the 2xx range.

public bool IsSuccessStatusCode { get; }

Property Value

bool

Method

The request method.

public required HttpMethod Method { get; init; }

Property Value

HttpMethod

StatusCode

The response status code.

public required HttpStatusCode StatusCode { get; init; }

Property Value

HttpStatusCode

Url

The absolute request URL.

public required string Url { get; init; }

Property Value

string

Methods

ReadJson(JsonSerializerOptions?)

Reads the response body as a JSON document model.

public JsonNode? ReadJson(JsonSerializerOptions? options = null)

Parameters

options JsonSerializerOptions?

Returns

JsonNode?

ReadJson<T>(JsonSerializerOptions?)

Deserializes the response body into the requested value type.

public T? ReadJson<T>(JsonSerializerOptions? options = null)

Parameters

options JsonSerializerOptions?

Returns

T?

Type Parameters

T

ReadText()

Decodes the response body using its Content-Type charset or byte-order mark, falling back to UTF-8.

public string ReadText()

Returns

string

ReadToml(TomlSerializerOptions?)

Reads the response body as a TOML document model.

public TomlTable ReadToml(TomlSerializerOptions? options = null)

Parameters

options TomlSerializerOptions?

Returns

TomlTable

ReadToml<T>(TomlSerializerOptions?)

Deserializes the response body into the requested value type.

public T? ReadToml<T>(TomlSerializerOptions? options = null)

Parameters

options TomlSerializerOptions?

Returns

T?

Type Parameters

T

ReadXml()

Reads the response body as an XML document model.

public XDocument ReadXml()

Returns

XDocument

ReadXml<T>()

Deserializes the response body into the requested value type.

public T? ReadXml<T>()

Returns

T?

Type Parameters

T

ReadYaml()

Reads the root node of one YAML document from the response body.

public YamlNode? ReadYaml()

Returns

YamlNode?

ReadYaml<T>(IDeserializer?)

Deserializes one YAML document from the response body.

public T? ReadYaml<T>(IDeserializer? deserializer = null)

Parameters

deserializer IDeserializer?

Returns

T?

Type Parameters

T