Implement http.RoundTripper on recorder.Recorder directly?
dnaeon opened this issue · comments
Just throwing this one here for discussion.
Right now recorder.Recorder
contains a Transport
field which implements the http.RoundTripper
interface, and this is the transport we give to clients for using as their transport.
Within a recorder.Recorder
we contain the Cassette
and mode
of the recorder. However the Transport
struct also contains Cassette
and mode
fields, which kind of leads to unnecessary repetition and more complexity.
What do you think of implementing http.RoundTripper
directly on the recorder.Recorder
type?
This would remove the internal Transport
we are currently using and avoid passing around the same Cassette
and mode
all over the place?
Of this is a breaking API change, so clients will have to address this, but we can probably handle that as part of a new release of go-vcr
.
Any thoughts? @davars ? Anyone?
Thanks,
Marin
As a first step could Recorder
delegate its mode
variable to Transport
, and drop its reference to Cassette
?