Releases: jarcoal/httpmock
Releases · jarcoal/httpmock
v1.4.1
What's Changed
- test: also test with go v1.25 and use golangci-lint v2.4.0 by @maxatome in #164
- Avoid data race when closing body by @DavyJohnes in #165
New Contributors
- @DavyJohnes made his first contribution in #165
Full Changelog: v1.4.0...v1.4.1
v1.4.0
What's Changed
- style:
// nolint:→//nolint:by @maxatome in #152 - feat: add
NewJsonResponseOrPanicfunction to simplify calls withResponderFromMultipleResponsesby @kilianpaquier in #151 - Update transport.go by @battlecook in #155
- Replaced
deferstatements witht.Cleanupin docs by @alvii147 in #157 - Make
http.Response.Statusrespect RFC 2616, like in Go stdlib. by @constantoine in #159 - docs: update resty example by @tymcgee in #160
- feat: enhance
Activateand addDeactivateNonDefaultfunctions by @maxatome in #161 - test: use golangci-lint v2.0.2 & go1.24 by @maxatome in #163
- docs: README typo by @maxatome
- docs: clarify ConnectionFailure doc by @maxatome
New Contributors
- @kilianpaquier made their first contribution in #151
- @battlecook made their first contribution in #155
- @alvii147 made their first contribution in #157
- @constantoine made their first contribution in #159
- @tymcgee made their first contribution in #160
Full Changelog: v1.3.1...v1.4.0
v1.3.1
v1.3.0
New features:
- new matcher feature, allowing to create a Responder based on net/http.Request content (header or body for example), so not only on method and URL as before. See the following new registering functions & methods:
- add following Responder methods, allowing to easily add some headers to the returned net/http.Response without the need to craft a Responder by hand:
Miscellaneous:
- documentation now uses new go1.19 doc features;
- go minimal version required is now 1.13;
- CI tests using go1.20 & golangci-lint v1.51.0.
v1.2.0
New features:
NewNotFoundResponderhelps to detect a possible path mistake (final/or double/cases);- add
(*MockTransport).Respondersmethod allowing to list registered responders.
Fixes:
-
url.RawPathis used instead ofurl.Pathwhen checking path alone for consistency with full URL check, which is always unescaped.
Let 2 registered responders:GET http://z.tld/foo%2fbarGET /foo%2fbar
Before this release:
GET http://z.tld/foo%2fbaris caught by 1GET http://unknown.tld/foo%2fbaris not caught as the tested path is/foo/barinstead of/foo%2fbar
From this release:
GET http://z.tld/foo%2fbaris caught by 1GET http://unknown.tld/foo%2fbaris caught by 2
-
save of old clients transports is now protected from concurrent writes (@roboslone).
Miscellaneous:
- now use go-testdeep to simplify tests (saves >500 test lines);
- go minimal version required is now 1.9;
- CI tests using go1.18 & golangci-lint v1.45.0;
- signatures (and so documentation) now use
anytype instead ofinterface{}, as appeared in go 1.18 (in a compatible manner with go<1.18).
Enjoy!
v1.1.0
New features:
- tell the user about possible mistakes concerning the mocked HTTP method;
- by default, registering a
Responderfor a lower-cased method amongCONNECT,DELETE,GET,HEAD,OPTIONS,POST,PUTandTRACE, produces a panic as it is probably a mistake. This behavior can be disabled by setting newMockTransport.DontCheckMethodfield totrueprior to theRegister*Responder*()call; - registering a
nilRespondernow unregisters it and zeroes its statistics; - add
Respondermethods:Delay(time.Duration)to delay a response,Then(Responder)to chain responders.
Fix:
- net/http and httpmock issued
Response.Bodyare 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
Responderzeroes its statistics.
Enjoy!
v1.0.8
v1.0.7
New feature:
- add
Filetype allowing to easily serve files contents
Fix:
- race condition in
GetCallCountInfo()thanks to @swithek
Misc:
- test coverage increased almost 100% (OK 99.843% :) )
- code reorganized
- more linters involved
- documentation updated
- examples style normalized
- CI now use github actions instead of travis
Enjoy!