Closed rgkirch closed 2 years ago
Oh, if I keep the same store atom but use a new bootstrap then maybe it would use the cached values. I'm probably having trouble because I'm not using it as intended.
record
injected after perform-request
gives me a store with nils like {0 nil, 1 nil, 2 nil}
Strange since I have to inject after in order to see the response...
(inject {:name ::spy
:leave #(doto % pprint)}
:after (:name martian-http/perform-request))
Hello,
Have you referred to the test? https://github.com/oliyh/martian/blob/04738957ecceca7b8900eacb70f223bf3a18f8e9/vcr/test/martian/vcr_test.cljc#L49
For recording, it needs to be before the http interceptor. For playback, it replaces the http interceptor.
Very possible that that readme is not correct, apologies for that if it's wasted some time for you.
Hope this helps
Hello,
I've improved the readme and ensured the code examples are correct, hope this helps.
Thank you for updating the docs! All of your feedback has been extremely helpful and I'm enjoying using martian. I'm sorry for not responding to your last message; I got hung up with something else.
I noticed that the vcr tests don't use :replace
. Is there an issue with the tests or can the playback interceptor implicitly replace the perform-request
interceptor?
Thanks again!
Hello,
In the test there is a subtle difference of using martian.core/interceptors
vs the readme which uses martian.clj-http/interceptors
, the latter containing the perform-request
interceptor while the former does not. The playback needs to replace this one to prevent the actual request being made, but in the test it isn't there to begin with.
Thanks for your contributions and feedback, they've been very helpful.
Cheers
Congrats on the release. Cheers!
The vcr docs inject the
record
interceptor afterperform-request
but my code only records if I inject beforeperform-request
.vcr docs:
my code:
I'm not able to get playback to work either before or after
perform-request
. Re-runningresponse-for
just accumulates responses but sends a new request each time. I want to only make a request the first time and the re-use the cached response.I've tried injecting
playback
both before and afterperform-request
but didn't notice any difference.For completness, here's what's accumulating in the store atom.
Thanks!