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], maxResponseHeaderSize: Int = 4096, timeout: Duration = 5.seconds): Resource[F, HttpResponse[F]]
Performs a single
request
.Performs a single
request
. Returns a Resource that provides 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.
The Resource ensures proper cleanup of the underlying connection. The response body stream remains available during the Resource's lifetime. Typical usage:
request(thatRequest).use { response => response.body.through(bodyProcessor).compile.drain }
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 Resource fails with TimeoutException if the timeout is triggered
- request
Request to make to server
- timeout
Request will fail if response header is not received within supplied timeout Note that this is timeout just for the header, the body is available as stream and may be processed at leisure. Also timeout applies after the request was sent, so if the request body is a stream that does not end, the timeout will not be applied.
-
abstract
def
sse[A](request: HttpRequest[F], maxResponseHeaderSize: Int = 4096)(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
-
abstract
def
websocket[I, O](request: WebSocketRequest, handshakeTimeout: FiniteDuration, maxResponseHeaderSize: Int = 4096, maxFrameSize: Int = 1024*1024)(onConnect: (HttpResponseHeader) ⇒ Pipe[F, Frame[I], Frame[O]])(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
- handshakeTimeout
Timeout to handshake initial websocket protocol before starting to exchange any data
- maxResponseHeaderSize
Max size of Http Response header received
- maxFrameSize
Maximum size of single WebSocket frame. If the binary size of single frame is larger than supplied value, WebSocket will fail.
- onConnect
Function to evaluate to pipe when successfully connected.
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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
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
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @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
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated
-
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
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.