aurelia / aurelia/http-client

Interceptors cannot short-circuit request/response

Open
#169 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
60
Forks
57
PR merge metrics
No merged PRs in 30d

Description

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`) 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.

Contributor guide

Open the contributing guide

Research direction

Compare the interceptor handling in the http-fetch and http-client modules, starting with the request interceptor path in each. Confirm how a returned Response or Promise bypasses the network call in http-fetch, then verify that http-client reaches the response half of its pipeline with the same behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.