case class Response(status: Int, content: Content = Content.empty, headers: Map[HttpString, HttpString] = Map.empty) extends Product with Serializable
An HTTP response.
Represent all the data available in the HTTP response headers, and the response content that can be consumed lazily if needed.
- status
the HTTP response code such as
200
or404
.- content
the response content.
- headers
the HTTP headers.
- Source
- Response.scala
- Alphabetic
- By Inheritance
- Response
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Response(status: Int, content: Content = Content.empty, headers: Map[HttpString, HttpString] = Map.empty)
- status
the HTTP response code such as
200
or404
.- content
the response content.
- headers
the HTTP 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
-
def
addHeaders(headers: (HttpString, HttpString)*): Response
Add some headers to this response.
Add some headers to this response.
- headers
the new headers to add.
- returns
a copy of the response with the new headers added.
-
def
addHeaders(headers: Map[HttpString, HttpString]): Response
Add some headers to this response.
Add some headers to this response.
- headers
the new headers to add.
- returns
a copy of the response with the new headers added.
-
def
apply[A](content: A)(implicit encoder: ContentEncoder[A]): Response
Set the content of this response.
Set the content of this response.
- content
the content to use for this response.
- encoder
the ContentEncoder to use to encode this content.
- returns
a copy of this response with a new content.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
assertSuccess: IO[Unit]
Return a successful unit IO if the response status is in the Success 2xx range.
Return a successful unit IO if the response status is in the Success 2xx range. Otherwise, it consumes the response as String and report the error as a failed IO.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- val content: Content
-
def
drain: IO[Unit]
Drain the content attached to this response.
Drain the content attached to this response. It is safe to call this operation even if the stream has already been consumed.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val headers: Map[HttpString, HttpString]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isRedirect: Boolean
- returns
true is this HTTP response is a redirect.
-
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
read[A](effect: (Stream[IO, Byte]) ⇒ IO[A]): IO[A]
Consume the content attached to this response by evaluating the provided effect function.
Consume the content attached to this response by evaluating the provided effect function.
- effect
the function to use to consume the stream.
- returns
eventually a value of type
A
.
-
def
readAs[A](implicit decoder: ContentDecoder[A]): IO[A]
Consume the content attached to this response and eventually produces a value of type
A
.Consume the content attached to this response and eventually produces a value of type
A
.- decoder
the ContentDecoder to use to read the content.
- returns
eventually a value of type
A
.
-
def
readSuccess[A](effect: (Stream[IO, Byte]) ⇒ IO[A]): IO[A]
Consume the content attached to this response by evaluating the provided effect function the status is in the Success 2xx range.
Consume the content attached to this response by evaluating the provided effect function the status is in the Success 2xx range. Otherwise, it consumes the response as String and report the error as a failed IO.
- effect
the function to use to consume the stream.
- returns
eventually a value of type
A
or a failure if the status code was not 2xx.
-
def
readSuccessAs[A](implicit decoder: ContentDecoder[A]): IO[A]
Consume the content attached to this response if the status is in the Success 2xx range.
Consume the content attached to this response if the status is in the Success 2xx range. Otherwise, it consumes the response as String and report the error as a failed IO.
- decoder
the ContentDecoder to use to read the content.
- returns
eventually a value of type
A
or a failure if the status code was not 2xx.
-
def
removeHeaders(headerNames: HttpString*): Response
Remove some headers from this response.
Remove some headers from this response.
- headerNames
the header names to remove
- returns
a copy of the response without the removed headers.
- val status: Int
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )