Skip to content

HttpClient

std/http-client@1. One HTTP request per Call. Usable response bodies include non-success statuses. Decoded 500–599 responses use ServerError; other final statuses use Completed. A body decoding fault takes precedence over status classification.

For an http:// URL, the default is HTTP/1.1. To contact a server that requires cleartext HTTP/2, set versions = ["http/2"]. An HTTPS URL continues to use the declared order.

This declaration comes from crates/rastok/src/lab.rs. Place the Connector in a Graph and wire its ports; the excerpt alone is not an App.

connector network : HttpClient {
url = "https://example.test/v1"
timeout = duration("5s")
codec = json
idempotent = true; behavior = deterministic
}

The contract index explains shared settings, build features and the distinction between a Contract, a Lab model and an installed Driver.

Calls on one instance are serialized; queue time counts toward timeout.

ModeDriver directionExchangeLab modelInstalled in this binary
No selectoroutboundcalllab-callNot compiled
ModePortDirectionType rule
allininputcodec = bytes → array<byte>; codec = json → variant; codec = string → string
alloutoutputcodec = bytes → array<byte>; codec = json → variant; codec = string → string; explicit JSON response type admitted
allexitoutputHttpClientExit, below
ModeOutput cardinality
allStatus 204 or 205: Completed with no out. Other Completed and ServerError: one out. Every Call ends with one exit.
CasePayloadCall visibility
BodyTooLarge{ limit: ulong }outcome_unknown
Completed{ status: int }after_effect
ConnectFailedEmptybefore_effect
DecodeFailed{ message: string }outcome_unknown
DnsFailedEmptybefore_effect
OutcomeUnknownEmptyoutcome_unknown
ProtocolFailedEmptyoutcome_unknown
ServerError{ status: int }after_effect
TimeoutExpiredEmptyoutcome_unknown
TlsFailedEmptybefore_effect

With codec = json, rastok check refuses a producer whose resolved type contains a value without a JSON form, using E-TYPE-INVALID. A variant producer is checked at execution instead: an unencodable request ends the Call with DecodeFailed before it is sent. Its message names in and the required codec representation. The JSON input is a variant; its object keys are not declared field names.

For a typed JSON response, a timestamp field reads a UTC string such as "2026-01-05T08:30:00.25Z". A timestamp? also admits null. An invalid or offset date ends the Call with DecodeFailed and no out delivery. In a data is DecodeFailed branch, data.message identifies the response field and what it expected. If the body is not JSON it names out instead. The message contains neither the rejected value nor a peer-supplied map key. To inspect the original value, receive it as a string or leave the response untyped.

A request URL can include a numeric identifier: url = "https://example.test/jobs/" + string(data.id). The number becomes a string explicitly; the JSON request codec does not change.

ModeSettingDomainPresence / defaultLatest phase
allauth_bearerstringoptionalinvocation
allbehaviordeterministic | probabilisticrequiredplan
allcodecbytes | json | stringrequiredplan
alljson_profileprojectedoptionalplan
allidempotentboolfalseplan
allheadersHTTP headersoptionalinvocation
allcustom_headersmap<string,array<string>>optionalinvocation
allidempotency_keystringoptionalinvocation
allmax_bodyByteSize"8MiB"plan
allmethodstring"GET"invocation
alltimeoutdurationrequiredinstance
alltls_caarray<byte>optionalinstance
alltls_certificatearray<byte>optionalinstance
alltls_private_keyarray<byte>optionalinstance
allurlstringrequiredinvocation
allversionsarray<http/1.1 | http/2 | http/3>["http/3", "http/2", "http/1.1"]plan
allzero_rttdisableddisabledplan

codec = json permits an explicit output out: Response. json_profile = projected additionally skips extra members and fills absent nullable fields, while rejecting malformed required values. auth_bearer = secret(...) and url = env(...) use the declared boot-reference seam even though the table lists each setting’s latest general phase. Those references are resolved from deployment configuration at startup, not from an input envelope. There is no automatic redirect or Retry: the graph declares its Retry policy.

fixture crates/rastok/tests/conformance_http_client.rs. Cases without a portable forced fixture: DnsFailed, OutcomeUnknown. Related tests: crates/rastok/src/connector/drivers/network/http_client.rs.

Diagram