final case class TestClient(behavior: Ref[Routes[Any, 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
- Alphabetic
- By Inheritance
- TestClient
- Serializable
- Serializable
- Product
- Equals
- Driver
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
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: -
def
addRoute[R](route: Route[R, Response]): ZIO[R, Nothing, Unit]
Adds a route definition to handle requests that are submitted by test cases
Adds a route definition to handle requests that are submitted by test cases
- R
Environment of the new route
- route
New route to be added to the TestClient
TestClient.addRoute { Method.ANY / trailing -> handler(Response.ok) }
Example: -
def
addRoutes[R](route: Route[R, Response], routes: Route[R, Response]*): ZIO[R, Nothing, Unit]
Adds routes to handle requests that are submitted by test cases
Adds routes to handle requests that are submitted by test cases
- R
Environment of the new route
- routes
New routes to be added to the TestClient
TestClient.addRoutes { Routes( Method.GET / trailing -> handler { Response.text("fallback") }, Method.GET / "hello" / "world" -> handler { Response.text("Hey there!") }, ) }
Example: -
def
addRoutes(app: Routes[Any, Response]): ZIO[Any, Nothing, Unit]
Adds an HttpApp to the TestClient
Adds an HttpApp to the TestClient
- app
The HttpApp to be added to the TestClient
TestClient.addRoutes(HttpApp.empty)
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[Routes[Any, Response]]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @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[_]
- 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()
-
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( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
widenError[E1](implicit ev: <:<[Throwable, E1]): ZClient.Driver[Any, E1]
- Definition Classes
- Driver