diff --git a/internal/proxy/generate_test.go b/internal/proxy/generate_test.go index e486337..718ee7a 100644 --- a/internal/proxy/generate_test.go +++ b/internal/proxy/generate_test.go @@ -22,6 +22,6 @@ func TestGenerate(t *testing.T) { cmd.Dir = "testoutput" out, err := cmd.Output() t.Log("\n" + string(out)) - require.NoError(t, err) - assert.Equal(t, 0, cmd.ProcessState.ExitCode()) + require.NoError(t, err, "test for generated code should not return error") + assert.Equal(t, 0, cmd.ProcessState.ExitCode(), "test for generated code should not exit with non-zero status code") } diff --git a/internal/proxy/templates/upstream/strict/strict-interface.tmpl b/internal/proxy/templates/upstream/strict/strict-interface.tmpl index ed1fa98..0881960 100644 --- a/internal/proxy/templates/upstream/strict/strict-interface.tmpl +++ b/internal/proxy/templates/upstream/strict/strict-interface.tmpl @@ -80,6 +80,7 @@ {{end}}{{/* if .QueryParams */}} req := base.Clone(base.Context()) + req.Method = "{{.Method}}" req.URL = queryURL {{ if .HeaderParams }} diff --git a/internal/proxy/testoutput/oapi-proxy.go b/internal/proxy/testoutput/oapi-proxy.go index 7c7ae1c..6890e32 100644 --- a/internal/proxy/testoutput/oapi-proxy.go +++ b/internal/proxy/testoutput/oapi-proxy.go @@ -568,6 +568,7 @@ func (r UpstreamProfileGetProfileRequestObject) ToRequest(base *http.Request) (* queryURL.RawQuery = queryValues.Encode() req := base.Clone(base.Context()) + req.Method = "GET" req.URL = queryURL return req, nil @@ -627,6 +628,7 @@ func (r UpstreamProfilePutProfileRequestObject) ToRequest(base *http.Request) (* queryURL.RawQuery = queryValues.Encode() req := base.Clone(base.Context()) + req.Method = "PUT" req.URL = queryURL return req, nil