def send_with

bend-trace-context@0.2.0.0 · native_http.bend:133

import bend-trace-context@0.2.0.0/native_http.bend as NativeHttp
import Base
import bend-trace-context@0.2.0.0/trace_context.bend as TC

133# Give one request that the service sends the context of a new operation, on
134# a caller's source: TC.Context.send_with on the carrier of `headers`, the
135# request's own header map, and the map of the fields it gives back (law
136# http_send). The request's old context fields go, whatever the case of
137# their names, and the new ones replace them; without a new operation, the
138# map forwards the received pair or carries no context fields.
139def send_with(~S: Type, ~read: S -> IO(S & Result<&1, &1, U32 & String, U32>), source: S, +limits: TC.Limits,
140  service: TC.Service, sampling: TC.Sampling, +policy: TC.FailurePolicy, headers: HeaderMap()) ->
141  IO(S & TC.FailurePolicy.result(policy, Outbound)):
142  IO.bind(S & TC.FailurePolicy.result(policy, TC.Sent), S & TC.FailurePolicy.result(policy, Outbound),
143    TC.Context.send_with(~S, ~read, source, limits, service, sampling, policy, carrier(headers)),
144    done => IO.pure(S & TC.FailurePolicy.result(policy, Outbound), Headers.written.done(S, policy, done)))

Uses (18)

Used by (1)