mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
fix: 🐛 Ignore URL parameters
This commit is contained in:
parent
3c5b8f6337
commit
05a513898a
@ -22,7 +22,7 @@ func New(cfg *config.Config, log *logger.Logger) fasthttp.RequestHandler { //nol
|
|||||||
code uint16
|
code uint16
|
||||||
)
|
)
|
||||||
|
|
||||||
if fromUrl, okUrl := extractCodeFromURL(string(ctx.RequestURI())); okUrl {
|
if fromUrl, okUrl := extractCodeFromURL(string(ctx.Path())); okUrl {
|
||||||
code = fromUrl
|
code = fromUrl
|
||||||
} else if fromHeader, okHeaders := extractCodeFromHeaders(reqHeaders); okHeaders {
|
} else if fromHeader, okHeaders := extractCodeFromHeaders(reqHeaders); okHeaders {
|
||||||
code = fromHeader
|
code = fromHeader
|
||||||
|
@ -61,7 +61,7 @@ func TestHandler(t *testing.T) {
|
|||||||
|
|
||||||
return &cfg
|
return &cfg
|
||||||
},
|
},
|
||||||
giveUrl: "http://testing/503.html",
|
giveUrl: "http://testing/503.html?rnd=123",
|
||||||
giveHeaders: map[string]string{"Accept": "application/json", "X-FooBar": "baz"},
|
giveHeaders: map[string]string{"Accept": "application/json", "X-FooBar": "baz"},
|
||||||
|
|
||||||
wantStatusCode: http.StatusServiceUnavailable,
|
wantStatusCode: http.StatusServiceUnavailable,
|
||||||
|
@ -62,7 +62,7 @@ func (s *Server) Register(cfg *config.Config) error {
|
|||||||
)
|
)
|
||||||
|
|
||||||
s.server.Handler = func(ctx *fasthttp.RequestCtx) {
|
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 {
|
switch {
|
||||||
// live endpoints
|
// live endpoints
|
||||||
|
Loading…
Reference in New Issue
Block a user