requestDefaultsMiddleware
Sourceimport { requestDefaultsMiddleware } from "@prestojs/rest";
requestDefaultsMiddleware(next,urlConfig,requestInit)
Middleware to set defaults on requestInit
.
This is a convenience for other middleware so they can assume certain properties are always set.
- If
method
is not set it will set it toGET
- If
headers
is not set will set it tonew Headers()
This is included by default in Endpoint.defaultConfig.getMiddleware.
Parameter | Type | Description | |
---|---|---|---|
* | next | Function | |
* | urlConfig | MiddlewareUrlConfig | |
* | requestInit | EndpointRequestInit |
Returns