HttpResponse

org.llm4s.http.HttpResponse
See theHttpResponse companion object
@Stable
final case class HttpResponse

HTTP response wrapper exposing status code, body, and headers.

Value parameters

body

Response body as a string

headers

Response headers as a multi-valued map (lowercase keys) Build one with HttpResponse.apply and change it with the with* setters; the constructor and copy are private, so a new field never breaks callers.

statusCode

HTTP status code (e.g. 200, 404)

Attributes

Companion
object
Source
Llm4sHttpClient.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Extension method from HttpResponse

The response when its status is 2xx, else a ServiceError carrying the status and the body. The body in the error is redacted and capped (Redaction.safeBody, 2048 characters), since a provider's error body can echo the request's credentials. The error also carries the response's request id (x-request-id, request-id, x-amzn-requestid or apim-request-id) and its Retry-After delay (delta-seconds or an HTTP-date), when it sent them.

The response when its status is 2xx, else a ServiceError carrying the status and the body. The body in the error is redacted and capped (Redaction.safeBody, 2048 characters), since a provider's error body can echo the request's credentials. The error also carries the response's request id (x-request-id, request-id, x-amzn-requestid or apim-request-id) and its Retry-After delay (delta-seconds or an HTTP-date), when it sent them.

Attributes

Source
Llm4sHttpClient.scala
def header(name: String): Option[String]

First value of header name, matched case-insensitively.

First value of header name, matched case-insensitively.

Attributes

Source
Llm4sHttpClient.scala
def toJson(fieldName: String): Result[JsonHttpResponse]
Extension method from HttpResponse

Attributes

Source
Llm4sHttpClient.scala

This response as Llm4sHttpClient.send returns one, its body the UTF-8 bytes of body: what a test double's send answers with.

This response as Llm4sHttpClient.send returns one, its body the UTF-8 bytes of body: what a test double's send answers with.

Attributes

Source
Llm4sHttpClient.scala

Sets the response body.

Sets the response body.

Attributes

Source
Llm4sHttpClient.scala

Sets the response headers (a multi-valued map with lowercase keys).

Sets the response headers (a multi-valued map with lowercase keys).

Attributes

Source
Llm4sHttpClient.scala
def withStatusCode(statusCode: Int): HttpResponse

Sets the HTTP status code.

Sets the HTTP status code.

Attributes

Source
Llm4sHttpClient.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product