-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Record and respect request duration #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dnaeon,
first of all, thanks for the quick reaction!
Works like a charm 👍 . I agree, you might get more accurate numbers with httptrace
, on the other hand I'm not sure if there are many use cases where this is required, especially cause real request times also generally vary.
Does it make sense to have the duration feature configurable? I'm sure there are people who use this library for different reasons and might want to keep the "fast" tests without latency.
Also, this change should probably go to a new major version as this is a breaking change, especially since the parsing of existing recordings doesn't work anymore because of the empty duration strings and the changed datatype.
Hey @JVecsei , I've just added another commit which allows skipping the recorded request latency during replay. In order to do that simply set The code as it is now should be compatible with older clients as well, since the recorded duration was never set before. Can you please also test the new commit and let me know if it looks good? Thanks! |
Hi @dnaeon, the flag works great. Thank you! duration: "" So this would fail now with this error:
So I think either it has to be changed back to manually parsing it after reading the file or having this as a feature in the next major release. What do you think? |
You are totally correct. I'll have to finish my cup of coffee next time I reply :) I think having this as a new major version makes sense, even if it is for this little feature. I'll make sure to tag this one as |
Perfect - I think this is a great addition to the library. |
Just tagged https://github.com/dnaeon/go-vcr/releases/tag/v2.0.0 Thanks! |
@dnaeon In case of a new major release there are a few more things to change to make it usable: major version suffix, see also here: Releasing Modules (v2 or Higher) |
Probably a better way would be to use here
net/http/httptrace
instead. I'm opening this up here for discussion.Related to #62