@hateoas-ts/resource - v1.4.3
    Preparing search index...

    Type Alias FetchMiddleware

    FetchMiddleware: (
        request: Request,
        next: (request: Request) => Promise<Response>,
    ) => Promise<Response>

    Middleware function for intercepting and modifying HTTP requests/responses.

    Middlewares form a chain where each can modify the request before passing to the next, and modify the response after receiving it.

    Type Declaration

    const authMiddleware: FetchMiddleware = async (request, next) => {
    request.headers.set('Authorization', `Bearer ${token}`);
    const response = await next(request);
    // Optionally transform response
    return response;
    };