oaspec/mock

Test helpers for oaspec/transport. The sync constructors return a transport.Send value, and the *_async constructors return a transport.AsyncSend, making it trivial to script fake responses in tests without standing up a real HTTP runtime.

Values

pub fn bytes(
  status status: Int,
  body body: BitArray,
) -> fn(transport.Request) -> Result(
  transport.Response,
  transport.TransportError,
)
pub fn bytes_async(
  status status: Int,
  body body: BitArray,
) -> fn(transport.Request) -> transport.Async(
  Result(transport.Response, transport.TransportError),
)
pub fn empty(
  status status: Int,
) -> fn(transport.Request) -> Result(
  transport.Response,
  transport.TransportError,
)
pub fn empty_async(
  status status: Int,
) -> fn(transport.Request) -> transport.Async(
  Result(transport.Response, transport.TransportError),
)
pub fn text(
  status status: Int,
  body body: String,
) -> fn(transport.Request) -> Result(
  transport.Response,
  transport.TransportError,
)
pub fn text_async(
  status status: Int,
  body body: String,
) -> fn(transport.Request) -> transport.Async(
  Result(transport.Response, transport.TransportError),
)
Search Document