Req adapter powered by Rust wreq.
attach/2— set adapter and merge optionsimpersonate/2— set browser profilerun/1— adapter entry point, called by Req
Summary
Functions
Attaches CloakedReq adapter behavior to an existing Req.Request.
Sets the impersonation profile and configures the CloakedReq Req adapter.
Runs the request through the native transport. Req calls this as the adapter.
Functions
@spec attach( Req.Request.t(), keyword() ) :: Req.Request.t()
Attaches CloakedReq adapter behavior to an existing Req.Request.
Supported adapter-relevant options:
:cookie_jar-%CloakedReq.CookieJar{}for automatic cookie persistence:connect_options- Req transport options for:timeout,:proxy, and:proxy_headers:impersonate- profile atom (e.g.:chrome_136,:"safari_17.4.1"):insecure_skip_verify- boolean:local_address- outbound source IP as string, IPv4 tuple, or IPv6 tuple:max_body_size- positive integer or:unlimited(default: 10 MB); caps both the request body (rejected before sending if larger) and the response body (truncated to an error once it exceeds the limit):pool-%CloakedReq.Pool{}built withCloakedReq.Pool.new/1, routing the request through a dedicated, isolated client and connection pool. The pool's client governs the impersonation profile, TLS verification, and connect timeout, so per-request:impersonate,:insecure_skip_verify, and the:connect_optionsconnect timeout are ignored (still validated if given). The:connect_optionsproxy,:local_address, headers, body,:cookie_jar, and:receive_timeoutstill apply per request.
Examples
iex> req = Req.new(url: "https://example.com") |> CloakedReq.attach(impersonate: :chrome_136)
iex> req.adapter
CloakedReq
iex> Req.Request.get_option(req, :impersonate)
:chrome_136
@spec impersonate(Req.Request.t(), atom()) :: Req.Request.t()
Sets the impersonation profile and configures the CloakedReq Req adapter.
Examples
iex> req = Req.new(url: "https://example.com") |> CloakedReq.impersonate(:chrome_136)
iex> Req.Request.get_option(req, :impersonate)
:chrome_136
iex> req.adapter
CloakedReq
@spec run(Req.Request.t()) :: {Req.Request.t(), Req.Response.t() | Exception.t()}
Runs the request through the native transport. Req calls this as the adapter.