diff --git a/mocks.go b/mocks.go index 63316c8..f24f8e4 100644 --- a/mocks.go +++ b/mocks.go @@ -327,6 +327,13 @@ func (m *Mock) Get(u string) *MockRequest { return m.request } +// Head configures the mock to match http method HEAD +func (m *Mock) Head(u string) *MockRequest { + m.parseUrl(u) + m.request.method = http.MethodHead + return m.request +} + // Put configures the mock to match http method PUT func (m *Mock) Put(u string) *MockRequest { m.parseUrl(u) diff --git a/mocks_test.go b/mocks_test.go index c7e8071..2828c84 100644 --- a/mocks_test.go +++ b/mocks_test.go @@ -793,6 +793,7 @@ func TestMocks_Request_SetsTheMethod(t *testing.T) { {http.MethodPut, func(m *Mock) { m.Put("/") }}, {http.MethodDelete, func(m *Mock) { m.Delete("/") }}, {http.MethodPatch, func(m *Mock) { m.Patch("/") }}, + {http.MethodHead, func(m *Mock) { m.Head("/") }}, } for _, test := range tests { t.Run(test.expectedMethod, func(t *testing.T) {