transparent_http
Types
pub type SimpleHttp(body) {
SimpleHttp(
setup_request: fn(Request(body)) -> Request(body),
base_request: Request(body),
sender: fn(Request(body)) -> Response(body),
)
}
Constructors
-
SimpleHttp( setup_request: fn(Request(body)) -> Request(body), base_request: Request(body), sender: fn(Request(body)) -> Response(body), )
pub type SimpleHttpBuilder(body) {
SimpleHttpBuilder(
setup_request: Option(fn(Request(body)) -> Request(body)),
base_request: Option(Request(body)),
initial_req_body: body,
sender: fn(Request(body)) -> Response(body),
)
}
Constructors
-
SimpleHttpBuilder( 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) -> SimpleHttp(
a,
)
Creates a default SimpleHttp client
pub fn new(builder: SimpleHttpBuilder(a)) -> SimpleHttp(a)
Creates a new SimpleHttp client, taking overrides from the SimpleHttpBuilder
pub fn new_builder(sender: fn(Request(a)) -> Response(a), initial_request_body: a) -> SimpleHttpBuilder(
a,
)