Search the site
BACKEND
Declare each API your app calls once, with its timeout and retries.
A call to a host you did not declare is refused before anything is sent.
ON THIS PAGE
Declare a host
Call a declared host
Undeclared hosts are refused
Status
# pubspec.yaml
dartvel:
http:
hosts:
paystack:
baseUrl: https://api.paystack.co
timeout: 10s
retries: { attempts: 2, backoff: exponential }Copy code to clipboard
auth: { bearer: SECRET_NAME } sends a secret as a bearer token.
headers, circuitBreaker and pool: { maxConcurrent } are there too.
An unknown key stops the build.
final Response response =
await DV.Http.host('paystack').get('/transaction/verify/$reference');
final Object? data = await response.body!.jsonDecode();Copy code to clipboard
get, head and delete take a path. post, put and patch also take json: or body:.
Pass idempotencyKey: to retry a POST safely.
The response is a standard Response with status, headers and body.
A literal URL no declared host covers stops dartvel routes with DV-HTTP-001. A URL built at run time is refused when the call runs.
try {
// A URL known only at run time is checked when it runs.
await DV.Http.get(url);
} on DVHttpUndeclaredHostException catch (error) {
// DV-HTTP-001: no declared host covers this URL, and nothing was sent.
DV.log(error.toString());
}Copy code to clipboard
Partial
Spec section: Outbound HTTP
Planned work and implementation limits
The build checks literal URLs only.
Bearer is the only auth scheme.
Backend code uses const DVHttp(), because DV is not available there.
FSL-1.1-MIT licensed. Built with Dartvel.
Dartvel is made by
To the bottom