Skip to content

🐛 [Bug]: GET routes should automatically register corresponding HEAD routes #3811

@vmpartner

Description

@vmpartner

Bug Description

I registered a GET route and expected HEAD to work as well, but received a 405 error.

How to Reproduce

See code example

Expected Behavior

expected HEAD work as well when GET registered

Fiber Version

v3.0.0-rc.2

Code Snippet (optional)

package main

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

func main() {
	f := fiber.New(fiber.Config{})
	f.Get("/", func(ctx fiber.Ctx) error {
		return ctx.SendString("Hello, World!")
	})
	f.Listen(":3000")
}

curl -X HEAD -I http://127.0.0.1:3000 - HTTP/1.1 405 Method Not Allowed
curl -X GET -I http://127.0.0.1:3000 - HTTP/1.1 200 OK

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions