Net.HttpResponse
enum HttpResponseSourcecase HttpResponse({ body = Body, headers = Map[String, List[String]], status = Int32, url = String })An HTTP response with final URL, status code, multi-valued headers, and 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.
def header(name: String, r: HttpResponse): Option[List[String]]
SourceReturns the list of values for the header with the given name, or None if not present.
def headerValue(name: String, r: HttpResponse): Option[String]
SourceReturns the first value of the header with the given name, or None if not present.
def headers(r: HttpResponse): Map[String, List[String]]
SourceReturns 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).