Bloccs.Effects.HTTP.Mock (bloccs v0.1.1)

Copy Markdown View Source

Mock HTTP backend. Refuses non-allowed hosts. Returns stubbed responses registered per-node via stub/3.

Test/dev backend (the default). Its stub registry is an Agent started lazily on first use and is NOT part of any supervision tree — fine for tests, not a production process. Use Bloccs.Effects.HTTP.Req in production.

Summary

Functions

Build the capability struct from a [effects].http declaration.

Clear all stubs. Test-only.

Register a stub response for a method + URL pattern. URL match is a literal string match for v0.1.

Functions

new(map)

Build the capability struct from a [effects].http declaration.

reset()

Clear all stubs. Test-only.

stub(method, url, response_fun)

@spec stub(String.t(), String.t(), (map() -> term())) :: :ok

Register a stub response for a method + URL pattern. URL match is a literal string match for v0.1.