requestDefaultsMiddleware

Source
import { 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 to GET
  • If headers is not set will set it to new Headers()

This is included by default in Endpoint.defaultConfig.getMiddleware.

ParameterTypeDescription
*next
Function
*urlConfigMiddlewareUrlConfig
*requestInitEndpointRequestInit
MiddlewareReturn