Skip to content

Interceptors cannot short-circuit request/response #169

@benhathaway

Description

@benhathaway

There is an asymmetry between interceptors in the http-client module and the http-fetch module.

The http-fetch module has the option to short-circuit the request/response process using an interceptor. You can return a Response object (or a Promise<Response>) from a request interceptor method and the fetch module will simply treat that response as the result of the process and switch directly to the response half of the pipeline (chain) without actually making any network calls.

This functionality is missing from the equivalent http-client module. This is clearly an unintentional asymmetry - and a feature that I will find very useful when writing a request batching plugin. It also looks to be only a couple of lines to change, so I intend to offer a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions