From 36275689b0ea717ba5621135ff998d3561cd47a3 Mon Sep 17 00:00:00 2001 From: Erik Winter Date: Sat, 4 Jul 2020 13:20:30 +0200 Subject: [PATCH] renamed http_mock --- test/{http_mock.go => httpmock.go} | 4 ++-- test/{http_mock_test.go => httpmock_test.go} | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) rename test/{http_mock.go => httpmock.go} (97%) rename test/{http_mock_test.go => httpmock_test.go} (96%) diff --git a/test/http_mock.go b/test/httpmock.go similarity index 97% rename from test/http_mock.go rename to test/httpmock.go index 3a70ff5..d0a8631 100644 --- a/test/http_mock.go +++ b/test/httpmock.go @@ -15,7 +15,7 @@ type MockResponse struct { } type MockServerProcedure struct { - URL string + URI string HTTPMethod string Response MockResponse } @@ -157,7 +157,7 @@ func NewMockServer(rec MockRecorder, procedures ...MockServerProcedure) *httptes for _, proc := range procedures { - if proc.URL == r.URL.RequestURI() && proc.HTTPMethod == r.Method { + if proc.URI == r.URL.RequestURI() && proc.HTTPMethod == r.Method { headers := w.Header() for hkey, hvalue := range proc.Response.Headers { diff --git a/test/http_mock_test.go b/test/httpmock_test.go similarity index 96% rename from test/http_mock_test.go rename to test/httpmock_test.go index 49559b7..ec4dc9b 100644 --- a/test/http_mock_test.go +++ b/test/httpmock_test.go @@ -17,21 +17,21 @@ func TestHTTPMock(t *testing.T) { procs := []test.MockServerProcedure{ test.MockServerProcedure{ - URL: "/", + URI: "/", HTTPMethod: "GET", Response: test.MockResponse{ Body: []byte("getRoot"), }, }, test.MockServerProcedure{ - URL: "/", + URI: "/", HTTPMethod: "POST", Response: test.MockResponse{ Body: []byte("postRoot"), }, }, test.MockServerProcedure{ - URL: "/get/header", + URI: "/get/header", HTTPMethod: "GET", Response: test.MockResponse{ StatusCode: http.StatusAccepted, @@ -42,21 +42,21 @@ func TestHTTPMock(t *testing.T) { }, }, test.MockServerProcedure{ - URL: "/get/auth", + URI: "/get/auth", HTTPMethod: "GET", Response: test.MockResponse{ Body: []byte("getRootAuth"), }, }, test.MockServerProcedure{ - URL: "/my_account", + URI: "/my_account", HTTPMethod: "GET", Response: test.MockResponse{ Body: []byte("getAccount"), }, }, test.MockServerProcedure{ - URL: "/my_account.json", + URI: "/my_account.json", HTTPMethod: "GET", Response: test.MockResponse{ Body: []byte("getAccountJSON"), @@ -240,7 +240,7 @@ func ExampleMockAssertion_Hits() { uri := "/" server := test.NewMockServer(&record, test.MockServerProcedure{ - URL: uri, + URI: uri, HTTPMethod: http.MethodGet, }) @@ -255,7 +255,7 @@ func ExampleMockAssertion_Headers() { uri := "/" server := test.NewMockServer(&record, test.MockServerProcedure{ - URL: uri, + URI: uri, HTTPMethod: http.MethodPost, }) @@ -270,7 +270,7 @@ func ExampleMockAssertion_Body() { uri := "/" server := test.NewMockServer(&record, test.MockServerProcedure{ - URL: uri, + URI: uri, HTTPMethod: http.MethodPost, })