-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
XHR Capture #552
Comments
I like this idea too. I took the liberty to port the script that @ucjonathan posted above into typescript: Hopefully this helps with the implementation. |
If anyone has already started a PR on this, please ping me. Thanks! |
I haven't done anything further with it. |
I haven't started anything new either |
I haven't spent any time looking at how the fetch API can be captured, but this Stackoverflow article seems to offer some ideas. |
A complex but solid implementation: https://github.com/Netflix/pollyjs I don't think we will integrate polly.js, but its implementation looks battle-tested. |
I’m in favor of working with our own home grown code to minimize the
runtime size as that is very important. We have the XHR figured out.
Maybe later this week I’ll spend some time working on intercepting the
fetch API as well. Have to admit I don’t have as much experience with
fetch as I do XmlHttpRequest. We can always look at other libraries to see
some of the techniques being used if there is something we can’t figure out
through research on stackoverflow, MDN, and other sites. Just my thoughts.
…On Wed, May 12, 2021 at 2:32 AM yz-yu ***@***.***> wrote:
A complex but solid implementation: https://github.com/Netflix/pollyjs
I don't think we will integrate polly.js, but its implementation looks
battle-tested.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#552 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHBA7VTJTASH6KAL4UMLVLTNIOG5ANCNFSM43Z3RUOA>
.
|
I'm sorry that I don't know typescript yet to more deeply contribute to the project. In an effort to help with the groundwork to capture the XHR calls I've written the following gist:
https://gist.github.com/ucjonathan/9adc68ee74b331f6da5e0a13e1652dac
This is a vanilla JS piece of code that will collect the XHR request/response details into an object and then trigger an event that can be listened to. I've mode provisions in the code to:
I'm hopeful that this code could be used as the foundation to start adding that XHR capture support as a new event type similar to what was done with the console logging.
The text was updated successfully, but these errors were encountered: