transparent_http
Types
pub type TransparentHttp(body) {
TransparentHttp(
setup_request: fn(Request(body)) -> Request(body),
base_request: Request(body),
sender: fn(Request(body)) -> Response(body),
)
}
Constructors
-
TransparentHttp( setup_request: fn(Request(body)) -> Request(body), base_request: Request(body), sender: fn(Request(body)) -> Response(body), )
pub type TransparentHttpBuilder(body) {
TransparentHttpBuilder(
setup_request: Option(fn(Request(body)) -> Request(body)),
base_request: Option(Request(body)),
initial_req_body: body,
sender: fn(Request(body)) -> Response(body),
)
}
Constructors
-
TransparentHttpBuilder( setup_request: Option(fn(Request(body)) -> Request(body)), base_request: Option(Request(body)), initial_req_body: body, sender: fn(Request(body)) -> Response(body), )
Arguments
-
setup_request
Function that is applied to the
base_request
before being passed to thereq
function -
base_request
Base request for contant values e.g. auth headers
-
initial_req_body
Initial value for request body, e.g.
""
-
sender
Function that sends a request and gets a response
-
Functions
pub fn default(sender: fn(Request(a)) -> Response(a), initial_request_body: a) -> TransparentHttp(
a,
)
Creates a default TransparentHttp client
pub fn new(builder: TransparentHttpBuilder(a)) -> TransparentHttp(
a,
)
Creates a new TransparentHttp client, taking overrides from the TransparentHttpBuilder
pub fn new_builder(sender: fn(Request(a)) -> Response(a), initial_request_body: a) -> TransparentHttpBuilder(
a,
)