HttpResponse

org.llm4s.http.HttpResponse
See theHttpResponse companion class
object HttpResponse

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply(statusCode: Int, body: String, headers: Map[String, Seq[String]]): HttpResponse

Creates an HttpResponse.

Creates an HttpResponse.

Value parameters

body

response body

headers

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

statusCode

HTTP status code

Attributes

Extensions

Extensions

extension (response: HttpResponse)
def ensureSuccess(provider: String): Result[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

def toJson(fieldName: String): Result[JsonHttpResponse]
extension [A](result: Result[A])
def mapServiceError(provider: String, message: String): Result[A]