ResponseModule

PackageAxial.HttpClient

Summary

NameSignatureSynopsis
Operations
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.

Operations

kind:member

text

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

Parameters

NameTypeDescription
responseHttpResponse

Returns

string
kind:member

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
kind:member

statusCode

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

Parameters

NameTypeDescription
responseHttpResponse

Returns

int
kind:member

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
kind:member

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>
kind:member

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