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
Headers
Response and content headers, with case-insensitive names.
public required IReadOnlyDictionary<string, IReadOnlyList<string>> Headers { get; init; }Property Value
IsSuccessStatusCode
Whether the status code is in the 2xx range.
public bool IsSuccessStatusCode { get; }Property Value
Method
The request method.
public required HttpMethod Method { get; init; }Property Value
StatusCode
The response status code.
public required HttpStatusCode StatusCode { get; init; }Property Value
Url
The absolute request URL.
public required string Url { get; init; }Property Value
Methods
ReadJson(JsonSerializerOptions?)
Reads the response body as a JSON document model.
public JsonNode? ReadJson(JsonSerializerOptions? options = null)Parameters
optionsJsonSerializerOptions?
Returns
ReadJson<T>(JsonSerializerOptions?)
Deserializes the response body into the requested value type.
public T? ReadJson<T>(JsonSerializerOptions? options = null)Parameters
optionsJsonSerializerOptions?
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
ReadToml(TomlSerializerOptions?)
Reads the response body as a TOML document model.
public TomlTable ReadToml(TomlSerializerOptions? options = null)Parameters
optionsTomlSerializerOptions?
Returns
- TomlTable
ReadToml<T>(TomlSerializerOptions?)
Deserializes the response body into the requested value type.
public T? ReadToml<T>(TomlSerializerOptions? options = null)Parameters
optionsTomlSerializerOptions?
Returns
- T?
Type Parameters
T
ReadXml()
Reads the response body as an XML document model.
public XDocument ReadXml()Returns
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
deserializerIDeserializer?
Returns
- T?
Type Parameters
T