CloakedReq.Native (cloaked_req v0.4.0)

Copy Markdown View Source

Rust NIF interface for HTTP request execution via wreq.

Request and response metadata are passed as native Elixir maps encoded/decoded directly by Rustler's NifMap. Bodies are passed as raw BEAM binaries.

Summary

Functions

Creates a new Rust-side cookie jar resource.

Sends the request metadata and body to the Rust NIF.

Functions

perform_request(payload, body, cookie_jar_ref \\ nil)

@spec perform_request(map(), binary() | nil, reference() | nil) ::
  {:ok, map(), binary()} | {:error, CloakedReq.Error.t()}

Sends the request metadata and body to the Rust NIF.

The metadata map is passed directly to the NIF (decoded via Rustler's NifMap). The body is passed as a raw binary (or nil). An optional cookie jar reference enables automatic cookie persistence across requests. Returns {:ok, response_meta, body} or {:error, %CloakedReq.Error{}}.