-
Notifications
You must be signed in to change notification settings - Fork 353
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
Error when adding the 'beforeRecord' event #12
Comments
If you plan to modify the response body before your XHR request resolves, you'll want to use An example of how to use this event to mutate your response body:
That said, it may be worth exploring throwing a more meaningful assertion vs exposing the default thrown error from Object.freeze. We've been working the last few days to iron out the event names so that they're hopefully more clear.
I can investigate this separately. |
Feel free to reopen or create a new issue if you have further questions or this doesn't solve what you were trying to do. |
@jasonmit thanks for the answer, I actually wanted to use it to anonymize / remove some data from the recording before commiting it to disk. Would that be the wrong place to do it? edit: Also why does it throw an error when I only use |
@piotrpalek yes I think you want This way your mutations to the response body (not limited to just the body, can include headers for an example) are captured in your test as well as persisted. |
A bug. Reopening. Accessing a frozen object should not have a side effect like this. |
@piotrpalek that error you were seeing about the read-only object should now be fixed on master and will be part of the 0.1.0 release that is going out in a few minutes. That said, I still believe for your use case you want to use the |
@jasonmit thanks! works great now 👍 also I agree, the |
Hey, I've been testing pollyjs in my Ember app, and it worked fine. Later I've added the
beforeRecord
event like this:and got this error (it goes away when I remove it):
(btw it'd be nice if source maps would work when in dev mode, so that it would be easier to debug issues like this)
The text was updated successfully, but these errors were encountered: