HttpResponse

case
class HttpResponse[T](body: T, code: Int, headers: Map[String, IndexedSeq[String]])

Result of executing a scalaj.http.HttpRequest

Type Params
T

the body response since it can be parsed directly to things other than String

Value Params
body

the Http response body

code

the http response code from the status line

headers

the response headers

trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def contentType: Option[String]

Content-Type header value

Content-Type header value

def cookies: IndexedSeq[HttpCookie]

Get the parsed cookies from the "Set-Cookie" header *

Get the parsed cookies from the "Set-Cookie" header *

def header(key: String): Option[String]

Get the response header value for a key

Get the response header value for a key

def headerSeq(key: String): IndexedSeq[String]

Get all the response header values for a repeated key

Get all the response header values for a repeated key

def is2xx: Boolean

is response code 2xx

is response code 2xx

def is3xx: Boolean

is response code 3xx

is response code 3xx

def is4xx: Boolean

is response code 4xx

is response code 4xx

def is5xx: Boolean

is response code 5xx

is response code 5xx

def isClientError: Boolean

same as is4xx

same as is4xx

def isCodeInRange(lower: Int, upper: Int): Boolean

test if code is in between lower and upper inclusive

test if code is in between lower and upper inclusive

def isError: Boolean

same as (is4xx || is5xx)

same as (is4xx || is5xx)

def isNotError: Boolean

same as !isError

same as !isError

def isRedirect: Boolean

same as is3xx

same as is3xx

def isServerError: Boolean

same as is5xx

same as is5xx

def isSuccess: Boolean

same as is2xx

same as is2xx

def location: Option[String]

Location header value sent for redirects. By default, this library will not follow redirects.

Location header value sent for redirects. By default, this library will not follow redirects.

def statusLine: String

The full status line. like "HTTP/1.1 200 OK" throws a RuntimeException if "Status" is not in headers

The full status line. like "HTTP/1.1 200 OK" throws a RuntimeException if "Status" is not in headers

Throw a

Throw a

scalaj.http.HttpStatusException}} if {{{isError

is true. Otherwise returns reference to self

Useful if you don't want to handle 4xx or 5xx error codes from the server and just want bubble up an Exception instead. HttpException.body will just be body.toString.

Allows for chaining like this:

val result: String = Http(url).asString.throwError.body

scalaj.http.HttpStatusException}} if {{{isError }}}

Useful if you don't want to handle 4xx or 5xx error codes from the server and just want bubble up an Exception instead. HttpException.body will just be body.toString.

Allows for chaining like this:

val result: String = Http(url).asString.throwError.body

Throw a

Throw a

scalaj.http.HttpStatusException}} if {{{isServerError

is true. Otherwise returns reference to self

Useful if you don't want to 5xx error codes from the server and just want bubble up an Exception instead. HttpException.body will just be body.toString.

Allows for chaining like this:

val result: String = Http(url).asString.throwServerError.body

scalaj.http.HttpStatusException}} if {{{isServerError }}}

Useful if you don't want to 5xx error codes from the server and just want bubble up an Exception instead. HttpException.body will just be body.toString.

Allows for chaining like this:

val result: String = Http(url).asString.throwServerError.body

Inherited methods

def productElementNames: Iterator[String]
Inherited from
Product
def productIterator: Iterator[Any]
Inherited from
Product