TestClient

zio.http.TestClient$
See theTestClient companion class
object TestClient

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Inherited types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def addHandler[R](handler: PartialFunction[Request, ZIO[R, Throwable, Response]]): ZIO[R & TestClient, 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

Attributes

R

Environment of the new handler's effect.

handler

New behavior to be added to the TestClient

Example:
  TestClient.addHandler{case request  if request.method == Method.GET => ZIO.succeed(Response.ok)}
def addRequestResponse(request: Request, response: Response): ZIO[TestClient, Nothing, Unit]

Adds an exact 1-1 behavior

Adds an exact 1-1 behavior

Attributes

request

The request that will trigger the response

response

The response to be returned when a user submits the response

Example:
  TestClient.addRequestResponse(Request.get(URL.root), Response.ok)

Concrete fields

val layer: ZLayer[Any, Nothing, TestClient]