-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ajax): add interceptors for parsed response JSON objects #2335
Conversation
🦋 Changeset detectedLatest commit: 3ed0929 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
12e129d
to
3e8c21f
Compare
3e8c21f
to
3ed0929
Compare
@ing-athirlwall could you maybe have a look? |
LGTM. Perhaps use "forEach" instead of "for..of" when iterating through the interceptors but that's just a niggle. |
as discussed in the chat, it was implemented the same way as other interceptor handlers, so should be good for code consistency :) e.g. this one: /**
* @param {Response} response
* @returns {Promise<Response>}
*/
async __interceptResponse(response) {
let interceptedResponse = response;
for (const intercept of this._responseInterceptors) {
// In this instance we actually do want to await for each sequence
// eslint-disable-next-line no-await-in-loop
interceptedResponse = await intercept(/** @type {CacheResponse} */ (interceptedResponse));
}
return interceptedResponse;
} |
Fair enough .. like the feature, let's release it. |
Approved and merged. Sorry for the delay (I thought you were able to approve this as well @ing-athirlwall) |
What I did
addResponseJsonInterceptor
to be able to intercept parsed response JSON objects