class

Anthropic::APIRequest

Inherits Reference < Object

A normalized, HTTP-shaped request handed to middleware.

The metadata hash is a mutable cross-attempt scratchpad: middleware may stash state there and read it on retries. Note that headers and metadata are shared by reference between an original request and copies derived via #withdup the headers before mutating them.

Constructors

new(method : String, path : String, headers : HTTP::Headers, body : String | Nil = nil, metadata : Hash(String, JSON::Any) = {} of String => JSON::Any)
Source

Instance methods

body
Source
headers
Source
metadata
Source
method
Source
path
Source
with(*, method : String | Nil = nil, path : String | Nil = nil, headers : HTTP::Headers | Nil = nil, body : String | Nil = nil) : APIRequest

Derive a copy with overridden fields. Passing nil (or omitting) a field keeps the original value — a body cannot be cleared through this method.

Source