Skip to content

Commit

Permalink
fix: 🐛 Ignore URL parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Jul 1, 2024
1 parent 3c5b8f6 commit 05a5138
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/http/handlers/error_page/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func New(cfg *config.Config, log *logger.Logger) fasthttp.RequestHandler { //nol
code uint16
)

if fromUrl, okUrl := extractCodeFromURL(string(ctx.RequestURI())); okUrl {
if fromUrl, okUrl := extractCodeFromURL(string(ctx.Path())); okUrl {
code = fromUrl
} else if fromHeader, okHeaders := extractCodeFromHeaders(reqHeaders); okHeaders {
code = fromHeader
Expand Down
2 changes: 1 addition & 1 deletion internal/http/handlers/error_page/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestHandler(t *testing.T) {

return &cfg
},
giveUrl: "http://testing/503.html",
giveUrl: "http://testing/503.html?rnd=123",
giveHeaders: map[string]string{"Accept": "application/json", "X-FooBar": "baz"},

wantStatusCode: http.StatusServiceUnavailable,
Expand Down
2 changes: 1 addition & 1 deletion internal/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *Server) Register(cfg *config.Config) error {
)

s.server.Handler = func(ctx *fasthttp.RequestCtx) {
var url, method = string(ctx.RequestURI()), string(ctx.Method())
var url, method = string(ctx.Path()), string(ctx.Method())

switch {
// live endpoints
Expand Down

0 comments on commit 05a5138

Please sign in to comment.