Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update transport.go #155

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func isRegexpURL(url string) bool {
return strings.HasPrefix(url, regexpPrefix)
}

func (m *MockTransport) checkMethod(method string, matcher Matcher) {
func (m *MockTransport) checkMethod(method string) {
if !m.DontCheckMethod && methodProbablyWrong(method) {
panic(fmt.Sprintf("You probably want to use method %q instead of %q? If not and so want to disable this check, set MockTransport.DontCheckMethod field to true",
strings.ToUpper(method),
Expand Down Expand Up @@ -594,7 +594,7 @@ func (m *MockTransport) checkMethod(method string, matcher Matcher) {
// Note that [github.com/maxatome/tdhttpmock] provides powerful helpers
// to create matchers with the help of [github.com/maxatome/go-testdeep].
func (m *MockTransport) RegisterMatcherResponder(method, url string, matcher Matcher, responder Responder) {
m.checkMethod(method, matcher)
m.checkMethod(method)

mr := matchResponder{
matcher: matcher,
Expand Down Expand Up @@ -775,7 +775,7 @@ found:
// Note that [github.com/maxatome/tdhttpmock] provides powerful helpers
// to create matchers with the help of [github.com/maxatome/go-testdeep].
func (m *MockTransport) RegisterRegexpMatcherResponder(method string, urlRegexp *regexp.Regexp, matcher Matcher, responder Responder) {
m.checkMethod(method, matcher)
m.checkMethod(method)

m.registerRegexpResponder(regexpResponder{
origRx: regexpPrefix + urlRegexp.String(),
Expand Down
Loading