scalaj.http

HttpResponse

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

Result of executing a HttpRequest

T

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

body

the Http response body

code

the http response code from the status line

headers

the response headers

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. HttpResponse
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HttpResponse(body: T, code: Int, headers: Map[String, IndexedSeq[String]])

    body

    the Http response body

    code

    the http response code from the status line

    headers

    the response headers

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. val body: T

    the Http response body

  8. def canEqual(arg0: Any): Boolean

    Definition Classes
    HttpResponse → Equals
  9. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  10. val code: Int

    the http response code from the status line

  11. def contentType: Option[String]

    Content-Type header value

  12. def cookies: IndexedSeq[HttpCookie]

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

  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Definition Classes
    HttpResponse → Equals → AnyRef → Any
  15. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  16. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Definition Classes
    HttpResponse → AnyRef → Any
  18. def header(key: String): Option[String]

    Get the response header value for a key

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

    Get all the response header values for a repeated key

  20. val headers: Map[String, IndexedSeq[String]]

    the response headers

  21. def is2xx: Boolean

    is response code 2xx

  22. def is3xx: Boolean

    is response code 3xx

  23. def is4xx: Boolean

    is response code 4xx

  24. def is5xx: Boolean

    is response code 5xx

  25. def isClientError: Boolean

    same as is4xx

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

    test if code is in beteween lower and upper inclusive

  27. def isError: Boolean

    same as (is4xx || is5xx)

  28. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  29. def isNotError: Boolean

    same as !isError

  30. def isRedirect: Boolean

    same as is3xx

  31. def isServerError: Boolean

    same as is5xx

  32. def isSuccess: Boolean

    same as is2xx

  33. def location: Option[String]

    Location header value sent for redirects.

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

  34. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  35. final def notify(): Unit

    Definition Classes
    AnyRef
  36. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  37. def productArity: Int

    Definition Classes
    HttpResponse → Product
  38. def productElement(arg0: Int): Any

    Definition Classes
    HttpResponse → Product
  39. def productIterator: Iterator[Any]

    Definition Classes
    Product
  40. def productPrefix: String

    Definition Classes
    HttpResponse → Product
  41. def statusLine: String

    The full status line.

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

  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  43. def throwError: HttpResponse[T]

    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
    
  44. def throwServerError: HttpResponse[T]

    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
    
  45. def toString(): String

    Definition Classes
    HttpResponse → AnyRef → Any
  46. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  47. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  48. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def productElements: Iterator[Any]

    Definition Classes
    Product
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) use productIterator instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any