final case class TestClient(behavior: Ref[HttpApp[Any, Throwable]], serverSocketBehavior: Ref[SocketApp[Any]]) extends Client 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
- ZClient
- 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
- final def @@[LowerEnv <: UpperEnv, UpperEnv <: Any, LowerIn <: UpperIn, UpperIn <: Body, LowerErr >: Throwable, UpperErr >: LowerErr, LowerOut >: Response, UpperOut >: LowerOut](aspect: ZClientAspect[LowerEnv, UpperEnv, LowerIn, UpperIn, LowerErr, UpperErr, LowerOut, UpperOut]): ZClient[UpperEnv, UpperIn, LowerErr, LowerOut]
- Definition Classes
- ZClient
- def addHandler[R](handler: PartialFunction[Request, ZIO[R, Throwable, 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 asInstanceOf[T0]: T0
- Definition Classes
- Any
- val behavior: Ref[HttpApp[Any, Throwable]]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def contramap[In2](f: (In2) => Body): ZClient[Any, In2, Throwable, Response]
- Definition Classes
- ZClient
- final def contramapZIO[Env1 <: Any, Err1 >: Throwable, In2](f: (In2) => ZIO[Env1, Err1, Body]): ZClient[Env1, In2, Err1, Response]
- Definition Classes
- ZClient
- final def delete(pathSuffix: String)(implicit trace: Trace, ev: <:<[Body, Body]): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def delete(pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def dieOn(f: (Throwable) => Boolean)(implicit ev1: IsSubtypeOfError[Throwable, Throwable], ev2: CanFail[Throwable], trace: Trace): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def get(pathSuffix: String)(implicit trace: Trace, ev: <:<[Body, Body]): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def get(pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def head(pathSuffix: String)(implicit trace: Trace, ev: <:<[Body, Body]): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def head(pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def header(key: String, value: String): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- val headers: Headers
- Definition Classes
- TestClient → ZClient
- final def host(host: String): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- val hostOption: Option[String]
- Definition Classes
- TestClient → ZClient
- def installSocketApp[Env1](app: Http[Any, Throwable, WebSocketChannelEvent, Unit]): ZIO[Env1, Nothing, Unit]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def map[Out2](f: (Response) => Out2): ZClient[Any, Body, Throwable, Out2]
- Definition Classes
- ZClient
- final def mapZIO[Env1 <: Any, Err1 >: Throwable, Out2](f: (Response) => ZIO[Env1, Err1, Out2]): ZClient[Env1, Body, Err1, Out2]
- Definition Classes
- ZClient
- 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 patch(pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def path(segment: String): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- val pathPrefix: Path
- Definition Classes
- TestClient → ZClient
- final def port(port: Int): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- val portOption: Option[Int]
- Definition Classes
- TestClient → ZClient
- final def post(pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def put(pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- val queries: QueryParams
- Definition Classes
- TestClient → ZClient
- def query(key: String, value: String): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- final def refineOrDie[Err2](pf: PartialFunction[Throwable, Err2])(implicit ev1: IsSubtypeOfError[Throwable, Throwable], ev2: CanFail[Throwable], trace: Trace): ZClient[Any, Body, Err2, Response]
- Definition Classes
- ZClient
- def request(body: Body, headers: Headers, hostOption: Option[String], method: Method, pathPrefix: Path, portOption: Option[Int], queries: QueryParams, schemeOption: Option[Scheme], sslConfig: Option[ClientSSLConfig], version: Version)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- TestClient → ZClient
- final def request(request: Request)(implicit ev: <:<[Body, Body], trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def request(method: Method, pathSuffix: String, body: Body)(implicit trace: Trace): ZIO[Any, Throwable, Response]
- Definition Classes
- ZClient
- final def retry[Env1 <: Any](policy: Schedule[Env1, Throwable, Any]): ZClient[Env1, Body, Throwable, Response]
- Definition Classes
- ZClient
- final def scheme(scheme: Scheme): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- val schemeOption: Option[Scheme]
- Definition Classes
- TestClient → ZClient
- val serverSocketBehavior: Ref[SocketApp[Any]]
- def socket[Env1](app: SocketApp[Env1], headers: Headers, hostOption: Option[String], pathPrefix: Path, portOption: Option[Int], queries: QueryParams, schemeOption: Option[Scheme], version: Version)(implicit trace: Trace): ZIO[Env1 with Scope, Throwable, Response]
- Definition Classes
- TestClient → ZClient
- final def socket[Env1 <: Any](url: String, app: SocketApp[Env1], headers: Headers)(implicit trace: Trace): ZIO[Env1 with Scope, Throwable, Response]
- Definition Classes
- ZClient
- final def socket[Env1 <: Any](pathSuffix: String)(app: SocketApp[Env1])(implicit trace: Trace): ZIO[Env1 with Scope, Throwable, Response]
- Definition Classes
- ZClient
- final def ssl(ssl: ClientSSLConfig): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- val sslConfig: Option[ClientSSLConfig]
- Definition Classes
- TestClient → ZClient
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def uri(uri: URI): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- final def url(url: URL): ZClient[Any, Body, Throwable, Response]
- Definition Classes
- ZClient
- 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])