Fiber: 馃悰 Invalid http method crashes fiber

Created on 10 Aug 2020  路  8Comments  路  Source: gofiber/fiber

Fiber version
1.13.3

Issue description
Lowercase patch crashes fiber, 'PATCH' works fine. This problem does not happen with other methods.

Code snippet

package main

import "github.com/gofiber/fiber"

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

  // Steps to reproduce

 app.Post("/api/one/:model", u.VerifyToken, d.Create)
// await fetch(url, { method: 'post', opts }) ==>  OK
// await fetch(url, { method: 'POST', opts }) ==> OK

 app.Patch("/api/one/:model", u.VerifyToken, d.Update)
// await fetch(url, { method: 'patch', opts }) ==>  crash
// await fetch(url, { method: 'PATCH', opts }) ==> OK

  app.Listen(3000)
}
鈽笍 Bug 馃彿 Wait for Release

Most helpful comment

@kiyonlin 'Under normal circumstances, http methods are all uppercase' Yes, you're right.
Thank you for taking the time, and for coding this beautiful library.
I'll close this for now.

All 8 comments

Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

thanks for the bug report

after some tests with, curl, httpie and node-fetch and several different constellations we don't know exactly how you produced the bug, please provide a step by step guide to the bug

First, I should mention that the work you did with fiber is awesome, Thanks a million.

Why would you test with curl, httpie, node-fetch and all the several different constellations you speak of and not test with browser fetch?! perhaps I should have been more specific.

Anyway, here's a simple working example demonstrating what I'm talking about :
https://github.com/dioslibre/fiber-patch-bug

Hi @dioslibre I ran your demo, and I found fetch send an OPTIONS request first before PATCH in my chrome so that fiber returns 405 Method Not Found.

hey @kiyonlin, I'm using chrome also, I don't get 405 Method Not Found, I get net::ERR_CONNECTION_REFUSED and fiber crashes.
Screenshot_2020-08-14_12-57-55

@Fenny it also crashes with curl, and not only with lowercase patch, but lowercase post also. I ran this curl -X post http://localhost:3000/api and it crashed. What did you do to test this on curl?

I already fixed this bug(#672), but it hasn't released yet. Under normal circumstances, http methods are all uppercase.

Anyway, thanks for your reporting!

@kiyonlin 'Under normal circumstances, http methods are all uppercase' Yes, you're right.
Thank you for taking the time, and for coding this beautiful library.
I'll close this for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renanbastos93 picture renanbastos93  路  3Comments

Terisback picture Terisback  路  3Comments

bashery picture bashery  路  4Comments

MohamedGouaouri picture MohamedGouaouri  路  3Comments

Ivan-Feofanov picture Ivan-Feofanov  路  3Comments