CloakedReq.Response (cloaked_req v0.4.0)

Copy Markdown View Source

Converts a native response meta map and body binary (from the Rust NIF) into a Req.Response.

Summary

Functions

Builds a Req.Response from the native response metadata and body binary.

Functions

from_native(meta, body)

@spec from_native(map(), binary()) ::
  {:ok, Req.Response.t()} | {:error, CloakedReq.Error.t()}

Builds a Req.Response from the native response metadata and body binary.

Expects atom-keyed :status and :headers in the metadata map (produced by Rustler's NifMap). Headers arrive as {name, value} tuples directly from Rust. Returns {:ok, %Req.Response{}} or {:error, %CloakedReq.Error{}}.