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

[middleware/filesystem]: Set response code #2632

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

cuipeiyu
Copy link
Contributor

A tiny Demo

package main

import (
	"net/http"

	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/fiber/v2/middleware/filesystem"
)

func main() {
	app := fiber.New()
	app.Use(
		"/",
		filesystem.New(filesystem.Config{
			Root: http.Dir("./try-a"),
		}),
		filesystem.New(filesystem.Config{
			Root: http.Dir("./try-b"),
		}),
	)

	app.Listen(":http")
}
$ tree
.
├── main.go
├── try-a
└── try-b
    └── index.html

3 directories, 2 files

Wrong response code 404

$ curl -I http://localhost/index.html
HTTP/1.1 404 Not Found
Date: Wed, 13 Sep 2023 04:16:23 GMT
Content-Type: text/html
Content-Length: 201
Last-Modified: Wed, 13 Sep 2023 04:00:02 GMT

@welcome
Copy link

welcome bot commented Sep 13, 2023

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@ReneWerner87 ReneWerner87 changed the title Set response code [middleware/filesystem]: Set response code Sep 13, 2023
@ReneWerner87 ReneWerner87 merged commit d0d5e9e into gofiber:master Sep 14, 2023
21 checks passed
@welcome
Copy link

welcome bot commented Sep 14, 2023

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@cuipeiyu cuipeiyu deleted the fix/specified_response_code branch September 15, 2023 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants