Packages

  • package root
    Definition Classes
    root
  • package sttp
    Definition Classes
    root
  • package client3
    Definition Classes
    sttp
  • package testing
    Definition Classes
    client3
  • class SttpBackendStub[F[_], +P] extends SttpBackend[F, P]

    A stub backend to use in tests.

    A stub backend to use in tests.

    The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches() method).

    Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

    For web socket requests, the stub can be configured to returned both custom WebSocket implementations, as well as WebSocketStub instances.

    For requests which return the response as a stream, if the stub should return a raw stream value (which should then be passed to the stream-consuming function, or mapped to another value), it should be wrapped with RawStream.

    Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

    Definition Classes
    testing
  • WhenRequest

class WhenRequest extends AnyRef

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WhenRequest
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WhenRequest(p: (Request[_, _]) ⇒ Boolean)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  15. def thenRespond[T](resp: ⇒ Response[T]): SttpBackendStub[F, P]
  16. def thenRespond[T](body: T, statusCode: StatusCode): SttpBackendStub[F, P]
  17. def thenRespond[T](body: T): SttpBackendStub[F, P]
  18. def thenRespondCyclic[T](bodies: T*): SttpBackendStub[F, P]
  19. def thenRespondCyclicResponses[T](responses: Response[T]*): SttpBackendStub[F, P]
  20. def thenRespondF(resp: (Request[_, _]) ⇒ F[Response[_]]): SttpBackendStub[F, P]
  21. def thenRespondF(resp: ⇒ F[Response[_]]): SttpBackendStub[F, P]
  22. def thenRespondNotFound(): SttpBackendStub[F, P]
  23. def thenRespondOk(): SttpBackendStub[F, P]
  24. def thenRespondServerError(): SttpBackendStub[F, P]
  25. def thenRespondWithCode(status: StatusCode, msg: String = ""): SttpBackendStub[F, P]
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped