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
Allow XHR interceptor in local development mode #22746
Allow XHR interceptor in local development mode #22746
Conversation
cc\ @zhangsu closed the PR with the json handling change and just went the route of doing the json in the response body as a string. Just an FYI, thanks for your review. |
cc\ @fstanis xhrInterceptor example. Will port over same changes to our partner dev code as it'll be cleaner and less noisy of an example. |
@choumx Hey Will when you get a chance. Thanks |
sandbox.stub(viewer, 'isTrustedViewer').returns(Promise.resolve(false)); | ||
interceptionEnabledWin.AMP_DEV_MODE = true; | ||
sandbox.stub(mode, 'getMode').returns({localDev: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can set test.win.AMP_MODE = {localDev: true};
to avoid the wildcard import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is actually not enclosed in the scenario test cases which mocks the window obj which is specific to testing native vs polyfill fetch, so this wouldn't work. Thanks for the input though.
* allow intercepting in non development mode * allow xhr intercept in local dev mode. add example for xhr intercept * fix test
follow up to addressing #22600 (comment)
-allow xhr interceptor in local dev mode and not in validation development mode.
-add viewer xhrInterceptor example.