Skip to content

Commit

Permalink
Merge pull request #39 from FireTail-io/patch-resource
Browse files Browse the repository at this point in the history
Fix resource including query string when no OpenAPI spec is used
  • Loading branch information
TheTeaCat authored Mar 4, 2024
2 parents 16f588f + 3434cc8 commit 20125ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion middlewares/http/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func GetMiddleware(options *Options) (func(next http.Handler) http.Handler, erro
Headers: r.Header,
Method: logging.Method(r.Method),
IP: strings.Split(r.RemoteAddr, ":")[0],
Resource: r.URL.RequestURI(), // We'll fill this in later if we have a router
Resource: r.URL.Path, // We'll fill this in later if we have a router
},
}
if r.TLS != nil {
Expand Down
4 changes: 2 additions & 2 deletions middlewares/http/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestNoSpec(t *testing.T) {
logEntry, err := logging.UnmarshalLogEntry(logs[0])
require.Nil(t, err)
assert.Equal(t, logEntry.Request.Resource, "/implemented/1")
assert.Equal(t, logEntry.Request.URI, "http://example.com/implemented/1")
assert.Equal(t, logEntry.Request.URI, "http://example.com/implemented/1?testparam=1")
wg.Done()
},
},
Expand All @@ -111,7 +111,7 @@ func TestNoSpec(t *testing.T) {
responseRecorder := httptest.NewRecorder()

request := httptest.NewRequest(
"POST", "/implemented/1",
"POST", "/implemented/1?testparam=1",
io.NopCloser(bytes.NewBuffer([]byte("{\"description\":\"test description\"}"))),
)
request.Header.Add("Content-Type", "application/json")
Expand Down

0 comments on commit 20125ed

Please sign in to comment.