UNPKG

@sap-cloud-sdk/http-client

Version:

SAP Cloud SDK for JavaScript http-client

32 lines (31 loc) 1.04 kB
import type { HttpMiddleware, Method } from './http-client-types'; /** * Options for middleware to fetch CSRF tokens. */ export interface CsrfMiddlewareOptions { /** * Method used for the token fetching. Default is `head`. */ method?: Method; /** * URL used for the token fetching. Default is the resource path without parameters. */ url?: string; /** * Middlewares added to the token retrieval request. */ middleware?: HttpMiddleware[]; } /** * Middleware for fetching a CSRF token. This middleware is added to all request per default. * Use the `fetchCsrfToken` option to disable it. * @param options - Options like URL or method to configure the token fetching. * @returns The middleware for fetching CSRF tokens. */ export declare function csrf(options?: CsrfMiddlewareOptions): HttpMiddleware; /** * @param headers - Request header information. * @returns CSRF related headers. * @internal */ export declare function buildCsrfFetchHeaders(headers: any): Record<string, any>;