Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 routes that match a previously registered static file handler return a status code of 404 #250

Closed
y21 opened this issue Mar 29, 2020 · 2 comments

Comments

@y21
Copy link

y21 commented Mar 29, 2020

Fiber version/commit
Fiber v1.8.42

Issue description
I'm not sure if this is a bug or intended behavior, but routes that match a previously registered static file handler will 404 (unless ctx.Status is explicitly called). I am aware that this can easily be avoided by simply registering a handler before registering static file handlers, but I don't think it should set a status code of 404 when there is a handler that matches the route.
image

Expected behavior
If the route matches one of the registered handlers, it should not set the status code to 404. If this is indeed intended behavior, the handler function should not be called.

Steps to reproduce

  1. Run the code belolw
  2. Visit localhost:3000
    ~> Webserver responds with test, but returns a status code of 404.

Code snippet

package main

import (
  "github.com/gofiber/fiber"
)

func main() {
  app := fiber.New()

  app.Static("/", "./public/")
  app.Get("/", func (c *fiber.Ctx) {
    c.Send("test")
  })

  app.Listen(3000)
}
@y21 y21 added the bug label Mar 29, 2020
@y21 y21 changed the title 🐞 routes that match a preivously registered static file handler return a status code of 404 🐞 routes that match a previously registered static file handler return a status code of 404 Mar 29, 2020
@Fenny Fenny mentioned this issue Mar 29, 2020
@Fenny
Copy link
Member

Fenny commented Mar 29, 2020

@y21, will be fixed in v1.8.43!

@Fenny
Copy link
Member

Fenny commented Mar 29, 2020

Merged https:/gofiber/fiber/releases/tag/v1.8.43 👍

@Fenny Fenny closed this as completed Mar 29, 2020
@Fenny Fenny mentioned this issue Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants