ResponseModule

PackageAxial.HttpClient

Summary

NameSignatureSynopsis
textResponse.text responseReturns the response body text.
bytesResponse.bytes responseReturns the exact response body bytes.
statusCodeResponse.statusCode responseReturns the response status code.
tryHeaderResponse.tryHeader name responseFinds the first header with the given case-insensitive name.
jsonResponse.json decode responseDecodes the response body with the supplied decoder, mapping failure to <c>HttpError.DecodeFailed</c>.
createResponse.create startedAt status bodyTextCreates a synthetic response transcript at an explicit start time, primarily for test fakes.

text

Response.text response
Member
Returns the response body text. <example><code>response |&gt; Response.text</code></example>

Parameters

NameTypeDescription
responseHttpResponse

Returns

string

bytes

Response.bytes response
Member
Returns the exact response body bytes. <example><code>response |&gt; Response.bytes</code></example>

Parameters

NameTypeDescription
responseHttpResponse

Returns

byte array

statusCode

Response.statusCode response
Member
Returns the response status code. <example><code>response |&gt; Response.statusCode</code></example>

Parameters

NameTypeDescription
responseHttpResponse

Returns

int

tryHeader

Response.tryHeader name response
Member
Finds the first header with the given case-insensitive name. <example><code>response |&gt; Response.tryHeader "ETag"</code></example>

Parameters

NameTypeDescription
namestring
responseHttpResponse

Returns

string option

json

Response.json decode response
Member
Decodes the response body with the supplied decoder, mapping failure to <c>HttpError.DecodeFailed</c>. <example><code>response |&gt; Response.json (Json.deserializeResult codec)</code></example>

Parameters

NameTypeDescription
decodestring -> Result<'value, string>
responseHttpResponse

Returns

Result<'value, HttpError>

create

Response.create startedAt status bodyText
Member
Creates a synthetic response transcript at an explicit start time, primarily for test fakes. <example><code>Response.create startedAt 200 """{"ok":true}"""</code></example>

Parameters

NameTypeDescription
startedAtDateTimeOffset
statusint
bodyTextstring

Returns

HttpResponse