Skip to content

XHR Capture #552

Open
@ucjonathan

Description

@ucjonathan

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:

  1. Allow for a custom function to perform redaction on the log record before further processing (masking of sensitive data that could be in the request/response.
  2. Allow for a custom function to suppress a particular capture. You don't really want to capture the XHR call you're making to store the events that RRWeb is collecting on your server. That would create a nasty feedback loop.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions