Closed MarkEdmondson1234 closed 6 years ago
Thanks for reporting. This should be fixed in https://github.com/nealrichardson/httptest/commit/570ffffa7332eb45b5618be749a5acfd85f3da0f. Please let me know if that addresses the issue for you. Working to get a CRAN release up for this.
And yes, to your last question, you can load the full R response from the recorded file. You don't have to copy and paste--just response <- source(filename)$value
. That's what with_mock_API
does, in fact: https://github.com/nealrichardson/httptest/blob/master/R/mock-api.R#L38
Also, for an immediate workaround, you can just delete the auth_token = <environment>
from the bad .R file that was written out, and then the rest of your code should work. The fix I pushed is only on the recording side (it will purge the auth_token from the request written out), so next time you record, you'll get clean files.
That works now, thanks!
Hi Neal, I have a failing test occur when the response includes an
auth_token = <environment>
field. The generated file is shown below - it is a POST batch fromgoogleanalyticsR
which is generated with this code ( link to file on GitHub)The POST response returns other responses within it that may be GET, DELETE etc - its a way to send many API calls at once. Perhaps it is unexpected for your mock functions though.
The offending response is below:
When trying to debug I tried to load the file contents via copy-pasting the created file's content and got the same error.
Also just for future reference, is the expected behaviour to be able to recreate the response from the copy-pasted file contents?