Golang 的 HTTP 模拟
Easy mocking of http responses from external resources.
Currently supports Go 1.16 to 1.27 and is regularly tested against tip.
v1 branch has to be used instead of master.
In your go files, simply use:
import "github.com/jarcoal/httpmock"
Then next go mod tidy or go test invocation will automatically
populate your go.mod with the latest httpmock release, now
.
…
…
When GET http://example.tld/some/path?b=12&a=foo&a=bar request is
caught, all standard responders are checked against the following URL
or paths, the first match stops the search:
http://example.tld/some/path?b=12&a=foo&a=bar (original URL)http://example.tld/some/path?a=bar&a=foo&b=12 (sorted query params)http://example.tld/some/path (without query params)/some/path?b=12&a=foo&a=bar (original URL without scheme and host)/some/path?a=bar&a=foo&b=12 (same, but sorted query params)/some/path (path only)If no standard responder matched, the regexp responders are checked, in the same order, the first match stops the search.
…
…
…
暂无开放 Issues,或尚未同步最近议题。