Reqord.CassetteEntry.Response (reqord v0.4.0)

View Source

Represents the response portion of a cassette entry.

Summary

Functions

Creates a new Response struct with validation.

Creates a new Response struct with automatic encoding detection.

Types

t()

@type t() :: %Reqord.CassetteEntry.Response{
  body_b64: String.t(),
  body_encoding: String.t(),
  body_external_ref: String.t() | nil,
  headers: Reqord.CassetteEntry.headers(),
  status: pos_integer(),
  stream_metadata: map() | nil
}

Functions

new(status, headers, body_b64)

@spec new(pos_integer(), map(), String.t()) :: {:ok, t()} | {:error, String.t()}

Creates a new Response struct with validation.

For backward compatibility, accepts Base64-encoded body. Use new_with_raw_body/3 for automatic encoding detection.

new_with_raw_body(status, headers, raw_body)

@spec new_with_raw_body(pos_integer(), map(), binary()) ::
  {:ok, t()} | {:error, String.t()}

Creates a new Response struct with automatic encoding detection.

This function analyzes the raw body content and determines the optimal storage strategy based on content type and size.