HttpResponse
Type of HTTP responses, and its functions.
enum HttpResponseSourceType of HTTP responses.
An HTTP response has a final URL, a status code, multi-valued headers, and a body.
Definitions
def body(r: HttpResponse): String§ SourceReturns the body of the response r as a string.
If the body is binary, it is decoded as UTF-8.
def bodyBytes(r: HttpResponse): Vector[Int8]§ SourceReturns the body of the response r as bytes.
If the body is text, it is encoded as UTF-8.
def contentLength(r: HttpResponse): Option[Int64]§ SourceReturns the value of the content-length header parsed as an Int64, or None if not present or not a valid number.
def contentType(r: HttpResponse): Option[String]§ SourceReturns the value of the content-type header, or None if not present.
def expect(r: HttpResponse): Result[IoError, HttpResponse]§ SourceReturns Ok(r) if the response status is in the 2xx range, or Err otherwise.
Returns the list of values for the header with the given name, or None if not present.
Returns the first value of the header with the given name, or None if not present.
Returns the headers of the response r.
def isClientError(r: HttpResponse): Bool§ SourceReturns true if the response status is in the 4xx range.
def isError(r: HttpResponse): Bool§ SourceReturns true if the response status is in the 4xx or 5xx range.
def isOk(r: HttpResponse): Bool§ SourceReturns true if the response status is 200 OK.
def isRedirect(r: HttpResponse): Bool§ SourceReturns true if the response status is in the 3xx range.
def isServerError(r: HttpResponse): Bool§ SourceReturns true if the response status is in the 5xx range.
def isSuccess(r: HttpResponse): Bool§ SourceReturns true if the response status is in the 2xx range.
def status(r: HttpResponse): Int32§ SourceReturns the status code of the response r.
def url(r: HttpResponse): String§ SourceReturns the final URL of the response r (after any redirects).