Skip to content

Fix interceptors#7

Open
omgaXD wants to merge 5 commits into
Asouei:masterfrom
omgaXD:fix-interceptors
Open

Fix interceptors#7
omgaXD wants to merge 5 commits into
Asouei:masterfrom
omgaXD:fix-interceptors

Conversation

@omgaXD

@omgaXD omgaXD commented Oct 21, 2025

Copy link
Copy Markdown

This PR makes onRequest interceptors more flexible and predictable and fixes #6

  • Added tests for interceptors:
    • onRequest:
      • test interception
      • test that modifying the arguments of the interceptor is a no-op
      • test that returning new values for the input url and request init actually alters the request
    • onResponse:
      • test interception
  • Modified onRequest type to support returning void / promise of void (means preserving the original request as-is) and to support returning new values for input and init / promise of input and init (means modifying the request).
  • Modified the docs to reflect this feature correctly (it was previously claiming that modifying onRequest args directly does something, which is not the case).

@omgaXD

omgaXD commented Oct 21, 2025

Copy link
Copy Markdown
Author

I accidentally started a PR into the original repo - meant to PR into my fork! Sorry about that.
Note that if you're interested in accepting the changes regardless, I did not update the changelog. I didn't change anything in the react-query thing as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow onRequest interceptors to modify the init config of the request

1 participant