UNPKG

855 BTypeScriptView Raw
1import { Request, Middleware } from ".";
2export declare type GetToken<Req> = (request: Req) => void | null | string;
3/**
4 * Adds the Authorization header with the returned string as the header value.
5 * Won't set the Authorization token if the result from getToken is falsey.
6 */
7export declare function withAuthorization<CustomRequestOptions extends object = any>(getToken: GetToken<Request<any, CustomRequestOptions>>, prefix?: string): Middleware<Request<any, CustomRequestOptions>, any>;
8/**
9 * Adds the Authorization header with the returned string as the bearer token.
10 * Won't set the Authorization token if the result from getToken is falsey.
11 */
12export declare function withBearer<CustomRequestOptions extends object = any>(getToken: GetToken<Request<any, CustomRequestOptions>>): Middleware<Request<any, CustomRequestOptions>, any>;