final case class TestClient(behavior: Ref[PartialFunction[Request, ZIO[Any, Response, Response]]], serverSocketBehavior: Ref[WebSocketApp[Any]]) extends http.ZClient.Driver[Any, Throwable] with Product with Serializable
Enables tests that use a client without needing a live Server
- behavior
Contains the user-specified behavior that takes the place of the usual Server
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- TestClient
- Serializable
- Product
- Equals
- Driver
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Instance Constructors
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 addHandler[R](handler: PartialFunction[Request, ZIO[R, Response, Response]]): ZIO[R, Nothing, Unit]
Adds a flexible handler for requests that are submitted by test cases
Adds a flexible handler for requests that are submitted by test cases
- R
Environment of the new handler's effect.
- handler
New behavior to be added to the TestClient
TestClient.addHandler{case request if request.method == Method.GET => ZIO.succeed(Response.ok)}
Example: - def addRequestResponse(expectedRequest: Request, response: Response): ZIO[Any, Nothing, Unit]
Adds an exact 1-1 behavior
Adds an exact 1-1 behavior
- expectedRequest
The request that will trigger the response
- response
The response to be returned when a user submits the response
TestClient.addRequestResponse(Request.get(URL.root), Response.ok)
Example: - final def apply(request: Request)(implicit trace: Trace): ZIO[zio.&[Any, Scope], Throwable, Response]
- Definition Classes
- Driver
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val behavior: Ref[PartialFunction[Request, ZIO[Any, Response, Response]]]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def disableStreaming(implicit ev: <:<[Throwable, Throwable]): ZClient.Driver[Any, Throwable]
- Definition Classes
- Driver
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def headers: Headers
- def installSocketApp[Env1](app: WebSocketApp[Any]): ZIO[Env1, Nothing, Unit]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def mapError[Err2](f: (Throwable) => Err2): ZClient.Driver[Any, Err2]
- Definition Classes
- Driver
- def method: Method
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def refineOrDie[Err2](pf: PartialFunction[Throwable, Err2])(implicit ev1: IsSubtypeOfError[Throwable, Throwable], ev2: CanFail[Throwable], trace: Trace): ZClient.Driver[Any, Err2]
- Definition Classes
- Driver
- def request(version: Version, method: Method, url: URL, headers: Headers, body: Body, sslConfig: Option[ClientSSLConfig], proxy: Option[Proxy])(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- TestClient → Driver
- final def request(req: Request)(implicit trace: Trace): ZIO[zio.&[Any, Scope], Throwable, Response]
- Definition Classes
- Driver
- final def retry[Env1 <: Any, Err1 >: Throwable](policy: Schedule[Env1, Err1, Any]): ZClient.Driver[Env1, Err1]
- Definition Classes
- Driver
- val serverSocketBehavior: Ref[WebSocketApp[Any]]
- def socket[Env1](version: Version, url: URL, headers: Headers, app: WebSocketApp[Env1])(implicit trace: Trace): ZIO[Env1 with Scope, Throwable, Response]
- Definition Classes
- TestClient → Driver
- def sslConfig: Option[ClientSSLConfig]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def url: URL
- def version: Version
- 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()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def widenError[E1](implicit ev: <:<[Throwable, E1]): ZClient.Driver[Any, E1]
- Definition Classes
- Driver