Humaans.HTTPClient.Req (Humaans v0.4.0)
View SourceDefault HTTP client implementation using Req
.
This module is used by default when you create a new Humaans client without specifying a custom HTTP client.
Customization
If you need to customize the Req client behavior (such as adding middleware, changing timeouts, etc.), you can implement your own client module that builds on this implementation while adding your specific modifications.
defmodule MyCustomReqClient do
@behaviour Humaans.HTTPClient.Behaviour
@impl true
def request(client, opts) do
Req.new(
base_url: client.base_url,
auth: {:bearer, client.access_token},
connect_options: [timeout: 30_000] # Custom timeout
)
|> Req.merge(opts)
# Add custom Req plugins or middleware here
|> Req.request()
end
end