ReqLLM.Streaming.Fixtures.HTTPContext (ReqLLM v1.0.0)

View Source

Lightweight HTTP context for streaming operations.

This struct contains the minimal HTTP metadata needed for fixture capture and debugging, replacing the heavier Req.Request/Response structs for streaming operations.

Summary

Functions

Builds HTTPContext from a Finch.Request struct.

Creates a new HTTPContext from request parameters.

Updates the context with response status and headers.

Types

t()

@type t() :: %ReqLLM.Streaming.Fixtures.HTTPContext{
  method: :get | :post | :put | :patch | :delete,
  req_headers: map(),
  resp_headers: map() | nil,
  status: integer() | nil,
  url: String.t()
}

Functions

from_finch_request(finch_request)

@spec from_finch_request(Finch.Request.t()) :: t()

Builds HTTPContext from a Finch.Request struct.

Extracts URL, method, and headers with proper sanitization.

new(url, method, headers)

@spec new(String.t(), :get | :post | :put | :patch | :delete, map()) :: t()

Creates a new HTTPContext from request parameters.

update_response(context, status, headers)

@spec update_response(t(), integer(), map()) :: t()

Updates the context with response status and headers.