v1.1.0
New features:
- tell the user about possible mistakes concerning the mocked HTTP method;
- by default, registering a
Responder
for a lower-cased method amongCONNECT
,DELETE
,GET
,HEAD
,OPTIONS
,POST
,PUT
andTRACE
, produces a panic as it is probably a mistake. This behavior can be disabled by setting newMockTransport.DontCheckMethod
field totrue
prior to theRegister*Responder*()
call; - registering a
nil
Responder
now unregisters it and zeroes its statistics; - add
Responder
methods:Delay(time.Duration)
to delay a response,Then(Responder)
to chain responders.
Fix:
- net/http and httpmock issued
Response.Body
are now consistent. Now, the httpmock one can only be read once: if some code wrongly depends onNewStringResponse()
&NewBytesResponse()
response body be read ad infinitum, it should be changed to either recallNewStringResponse()
&NewBytesResponse()
before reading again the response body, or useNewStringResponder()
&NewBytesResponder()
.
Doc:
- document that (re-)registering a
Responder
zeroes its statistics.
Enjoy!