trait HttpClient[F[_]] extends AnyRef
- Source
- HttpClient.scala
- Alphabetic
- By Inheritance
- HttpClient
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
request(request: HttpRequest[F], chunkSize: Int = 32*1024, maxResponseHeaderSize: Int = 4096, timeout: Duration = 5.seconds): Stream[F, HttpResponse[F]]
Performs a single
request
.Performs a single
request
. Returns one response if client replied.Note that request may contain stream of bytes that shall be sent to client. The response from server is evaluated _after_ client sent all data, including the body to the server.
Note that the evaluation of
body
in HttpResponse may not outlive scope of resulting stream. That means only correct way to process the result is within the flatMap i.e.request(thatRequest).flatMap { response => response.body.through(bodyProcessor) }
This methods allows to be supplied with timeout (default is 5s) that the request awaits to be completed before failure.
Timeout is computed once the requests was sent and includes also the time for processing the response header but not the body.
Resulting stream fails with TimeoutException if the timeout is triggered
- request
Request to make to server
- chunkSize
Size of the chunk to used when receiving response from server
- timeout
Request will fail if response header and response body is not received within supplied timeout
-
abstract
def
sse[A](request: HttpRequest[F], maxResponseHeaderSize: Int = 4096, chunkSize: Int = 32 * 1024)(implicit arg0: SSEDecoder[A]): Stream[F, A]
Reads SSE encoded stream of data from the server.
Reads SSE encoded stream of data from the server.
- request
Request to server. Note that this must be
GET
request.- maxResponseHeaderSize
Max size of expected response header
- chunkSize
Max size of the chunk
-
abstract
def
websocket[I, O](request: WebSocketRequest, pipe: Pipe[F, Frame[I], Frame[O]], maxResponseHeaderSize: Int = 4096, chunkSize: Int = 32 * 1024, maxFrameSize: Int = 1024*1024)(implicit arg0: Decoder[I], arg1: Encoder[O]): Stream[F, Option[HttpResponseHeader]]
Establishes websocket connection to the server.
Establishes websocket connection to the server.
Implementation is according to RFC-6455 (https://tools.ietf.org/html/rfc6455).
If this is established successfully, then this consults
pipe
to receive/sent any frames From/To server. Once the connection finishes, this will emit once None.If the connection was not established correctly (i.e. Authorization failure) this will not consult supplied pipe and instead this will immediately emit response received from the server.
- request
WebSocket request
- pipe
Pipe that is consulted when WebSocket is established correctly
- maxResponseHeaderSize
Max size of Http Response header received
- chunkSize
Size of receive buffer to use
- maxFrameSize
Maximum size of single WebSocket frame. If the binary size of single frame is larger than supplied value, WebSocket will fail.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to any2stringadd[HttpClient[F]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (HttpClient[F], B)
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to ArrowAssoc[HttpClient[F]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
ensuring(cond: (HttpClient[F]) ⇒ Boolean, msg: ⇒ Any): HttpClient[F]
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to Ensuring[HttpClient[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (HttpClient[F]) ⇒ Boolean): HttpClient[F]
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to Ensuring[HttpClient[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): HttpClient[F]
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to Ensuring[HttpClient[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): HttpClient[F]
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to Ensuring[HttpClient[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to StringFormat[HttpClient[F]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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( ... )
-
def
→[B](y: B): (HttpClient[F], B)
- Implicit
- This member is added by an implicit conversion from HttpClient[F] to ArrowAssoc[HttpClient[F]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc