Anthropic::APIRequest
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 #with — dup the headers before mutating them.
Constructors
Instance methods
body
Sourceheaders
Sourcemetadata
Sourcemethod
Sourcepath
Sourcewith(*, 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.