Trails Packages
    Preparing search index...

    Interface Interceptor

    Http interceptors can intercept HTTP requests made by the HttpService.

    Interceptors can be used, for example, to add additional query parameters or http headers or to manipulate a backend response.

    Use the interface name http.Interceptor to provide an implementation of this interface.

    Note that the request interceptor API is experimental: it may change with a new minor release as a response to feedback.

    interface Interceptor {
        beforeRequest?(params: BeforeRequestParams): void | Promise<void>;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • This method will be invoked for every request made by the HttpService.

      The params passed to the interceptor method can be inspected and can also be updated to change how the request is going to be made. For example, target and options.headers can be modified.

      The method implementation can be asynchronous.

      NOTE: There may be more than one interceptor in an application. All interceptors are invoked for every request. The order in which the interceptors are invoked is currently not defined.

      Parameters

      Returns void | Promise<void>