Closed timkaye11 closed 9 years ago
+1
@timkaye11 Can this be used to work with github.com/parnurzeal/gorequest
?
@pires I believe so - you'd just have to call ActivateNonDefault(s.Client)
where s
is the SuperAgent. https://github.com/parnurzeal/gorequest/blob/master/main.go#L565
@timkaye11 didn't work.
@timkaye11 what is now obvious to me is that I had to comment the line you linked and it worked. Ofc, commenting said line will break runtime.
@timkaye11 thanks!
In order to enable mock testing, we currently replace the
http.DefaultTransport
with the mock transport in theActivate
function. However, we run into errors when we use clients other thanhttp.DefaultClient
(which uses the default transport). In order to handle non-default clients, this PR introduces theActivateNonDefault
function, which replaces custom thehttp.Transport
with the mock transport for customhttp.Clients
.Also bumped travis to the newest version and added a unit test for the new function.