fix: 🐛 Ignore URL parameters

This commit is contained in:
Paramtamtam 2024-07-01 23:59:10 +04:00
parent 3c5b8f6337
commit 05a513898a
No known key found for this signature in database
GPG Key ID: 366371698FAD0A2B
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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,

View File

@ -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