github.com/jarcoal/httpmock
v1.4.2
#1054 most downloaded on Go modules
jarcoal/httpmock
What this package is like to depend on
Last release 27 days ago
28 Jul 2026
Release timing varies
gaps range from 3 weeks to 12 months
Most releases are documented
notes for 10 of 16 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
138 releases · first in 2014
1 release in the last 12 months
see the full history below
Release timeline
138 releases · Feb 2014 to Jul 2026Releases
latest 60 of 138-
v1.4.228 Jul 2026Release notes
Open source →What's Changed
- test: also test with go v1.26 and use golangci-lint v2.9.0 by @maxatome in #166
- test: use golangci-lint v2.12.2 by @maxatome in #167
- test: update install-go by @maxatome in #168
- feat: Responder.Delay can be interrupted by context cancellation by @maxatome in #169
Full Changelog: v1.4.1...v1.4.2
-
v1.4.118 Aug 2025Release notes
Open source →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.1-0.20250815103126-c9771456622015 Aug 2025 pre-releaseNothing published for this version
-
v1.4.005 Apr 2025Release notes
Open source →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
- style:
-
v1.3.2-0.20250405214556-dc21346aceb305 Apr 2025 pre-releaseNothing published for this version
-
v1.3.2-0.20250119110158-8cdfbf12463319 Jan 2025 pre-releaseNothing published for this version
-
v1.3.2-0.20250117122159-22259905162217 Jan 2025 pre-releaseNothing published for this version
-
v1.3.2-0.20241227090903-ee13561433fc27 Dec 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20241114135922-1ebd59a9cfc514 Nov 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20241007075508-8705bb329a2207 Oct 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20241007075424-6eb813e797e407 Oct 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20240814092535-7b7821f47cba14 Aug 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20240624070954-0a14bd7275e124 Jun 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20240418181948-d95b1ca4f45818 Apr 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20240207101530-c72d04a80ca707 Feb 2024 pre-releaseNothing published for this version
-
v1.3.2-0.20230817112440-39ed85b8199e17 Aug 2023 pre-releaseNothing published for this version
-
v1.3.116 Aug 2023Release notes
Open source →Fix:
- BodyContainsBytes & BodyContainsString used with And/Or by @maxatome in #146 thanks to @Moon1706 for the report → #145.
-
v1.3.1-0.20230816125544-497153dd46a416 Aug 2023 pre-releaseNothing published for this version
-
v1.3.1-0.20230525215230-070d3c85e07325 May 2023 pre-releaseNothing published for this version
-
v1.3.1-0.20230421130126-1ddb9fa5c42c21 Apr 2023 pre-releaseNothing published for this version
-
v1.3.1-0.20230405150342-507a05e8629b05 Apr 2023 pre-releaseNothing published for this version
-
v1.3.002 Feb 2023Release notes
Open source →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.1-0.20230202091431-e977d517e96802 Feb 2023 pre-releaseNothing published for this version
-
v1.2.1-0.20230120121550-837f061d506d20 Jan 2023 pre-releaseNothing published for this version
-
v1.2.1-0.20230117095810-d4ab20c68d8b17 Jan 2023 pre-releaseNothing published for this version
-
v1.2.1-0.20221123204859-b9e83a2877b223 Nov 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221108221151-f69cd5e7f9cf08 Nov 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221108215555-dfc8f19478d908 Nov 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221108194521-59c197c7f94608 Nov 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221107220010-e78b81264f6c07 Nov 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221107220010-a55e9610f3eb07 Nov 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221022183827-0f002063db7c22 Oct 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221022183404-54041f89094222 Oct 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221022181729-6c7ffdae9d8222 Oct 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221022181349-55fe60a9f0c222 Oct 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221021220603-a7ac8598580b21 Oct 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20221018195402-03500681be3118 Oct 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20220929030432-b02373e1ae6029 Sep 2022 pre-releaseNothing published for this version
-
v1.2.1-0.20220826122235-f6c487638cbd26 Aug 2022 pre-releaseNothing published for this version
-
v1.2.006 May 2022Release notes
Open source →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.1-0.20220402092947-377286aad7d002 Apr 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220402092625-afe87ee5d15802 Apr 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220318175323-bbd5dcb0762f18 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220318175212-6b1d5765b1ea18 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220313174918-0be0f8bf5ae513 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220311212526-fa558ecb43b711 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220311211424-7e3f2b37172511 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220311105657-d90b23c4deb711 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220308202130-9d0910aa879f08 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220308202046-152d504a397708 Mar 2022 pre-releaseNothing published for this version
-
v1.1.1-0.20220307135119-8b419ae5f71c07 Mar 2022 pre-releaseNothing published for this version
-
v1.1.022 Dec 2021Release notes
Open source →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.9-0.20211221144414-5115a496194921 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211221141540-7256da5fe7a821 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211221101746-2f54c7f2ce1a21 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211220163708-25b82c67d94020 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211217091311-bad3e1a5e10717 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211217053434-4caebc1ced9d17 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211217052851-3ad5c02322bf17 Dec 2021 pre-releaseNothing published for this version
-
v1.0.9-0.20211217045247-d0a0092b08e817 Dec 2021 pre-releaseNothing published for this version