DebugAPIProviderclass
new DebugAPIProvider<P, R>()
| Return | |
|---|---|
DebugAPIProvider<P, R> | Provider that logs every request, response, and error to the console in detail to help diagnose issues in development. |
Provider that logs every request, response, and error to the console in detail to help diagnose issues in development.
A wrapping provider for development. DebugAPIProvider writes verbose console output for every call — including full request and response bodies — so you can see exactly what is going over the wire.
It is the noisy counterpart to LoggingAPIProvider: use DebugAPIProvider while developing, and LoggingAPIProvider (or nothing) in production.
Usage
import { ClientAPIProvider, DebugAPIProvider } from "shelving/api"
const provider = new DebugAPIProvider(
new ClientAPIProvider({ url: "https://api.example.com" })
)
await provider.call(getUser, { id: "u_123" })
// Console shows the full request and response, including bodies.Examples
const api = new DebugAPIProvider(source); await api.call(endpoint, payload); // logs request, response, and result