case class HttpResponse[T](body: T, code: Int, headers: Map[String, IndexedSeq[String]]) extends Product with Serializable
Result of executing a scalaj.http.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
- Alphabetic
- By Inheritance
- HttpResponse
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val body: T
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val code: Int
- def contentType: Option[String]
Content-Type header value
- def cookies: IndexedSeq[HttpCookie]
Get the parsed cookies from the "Set-Cookie" header *
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def header(key: String): Option[String]
Get the response header value for a key
- def headerSeq(key: String): IndexedSeq[String]
Get all the response header values for a repeated key
- val headers: Map[String, IndexedSeq[String]]
- def is2xx: Boolean
is response code 2xx
- def is3xx: Boolean
is response code 3xx
- def is4xx: Boolean
is response code 4xx
- def is5xx: Boolean
is response code 5xx
- def isClientError: Boolean
same as is4xx
- def isCodeInRange(lower: Int, upper: Int): Boolean
test if code is in between lower and upper inclusive
- def isError: Boolean
same as (is4xx || is5xx)
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isNotError: Boolean
same as !isError
- def isRedirect: Boolean
same as is3xx
- def isServerError: Boolean
same as is5xx
- def isSuccess: Boolean
same as is2xx
- def location: Option[String]
Location header value sent for redirects.
Location header value sent for redirects. By default, this library will not follow redirects.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- 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
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- 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
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
- 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
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
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Simple http request library. Makes it easy to issue an http request and get a result.
Overview
The main entry point is the scalaj.http.Http singleton. Calling Http(url) will return an instance of scalaj.http.HttpRequest which you can use to build up your request. Execute the request by calling one of the asXXX methods and get a scalaj.http.HttpResponse which will contain the responseCode, body and response headers.
Usage Example