docs: clarify interceptors execution order #7201
Open
+35
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR clarifies the execution order of interceptors in the axios documentation.
Problem
Request interceptors execute in reverse order (LIFO) while response interceptors execute in normal order (FIFO). This intentional behavior is:
unshiftvspush)I was extremel surprised by this behavior and assumed it's a bug, when it's actually an intentional design that I guess creates a symmetric middleware/"onion" pattern? Anyways, I do believe it's a must to be properly documented.
Changes
I've updated the
README.md- Interceptors section. There are no real code changes, so no testing is required. I've verified markdown rendered properly.Fixes #7200