We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BodyParser uses a series of if-else statements with calls to strings.HasPrefix to match the content type
BodyParser
if-else
strings.HasPrefix
Any reason why it wan't implemented with a simple switch-case?
switch-case
Also, the else part is useless since it's returning when a type is matched.
else
I also suggest defining a global fiber.Err type for body parser to better identify body parse errors.
fiber.Err
fiber/ctx.go
Lines 247 to 282 in 9049720
The text was updated successfully, but these errors were encountered:
🚧 refactor bodyparser
a1879ce
Co-Authored-By: Mones Zarrugh <11161902+moneszarrugh@users.noreply.github.com> gofiber#1067
Refactored the code, and we now return a 422 error when an invalid content-type is present, see 400 vs 422 for more information. Tagged in https://github.com/gofiber/fiber/releases/tag/v2.2.5, thanks for the report 👍
Sorry, something went wrong.
No branches or pull requests
BodyParser
uses a series ofif-else
statements with calls tostrings.HasPrefix
to match the content typeAny reason why it wan't implemented with a simple
switch-case
?Also, the
else
part is useless since it's returning when a type is matched.I also suggest defining a global
fiber.Err
type for body parser to better identify body parse errors.fiber/ctx.go
Lines 247 to 282 in 9049720
The text was updated successfully, but these errors were encountered: