1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-03-14 02:57:43 +00:00
fiber/middleware
Jason McNeil 4ab8629706 fix(middleware/cors): Validation of multiple Origins (#2883)
* fix: allow origins check

Refactor CORS origin validation and normalization to trim leading or trailing whitespace in the cfg.AllowOrigins string [list]. URLs with whitespace inside the URL are invalid, so the normalizeOrigin will return false because url.Parse will fail, and the middleware will panic.

fixes #2882

* test: AllowOrigins with whitespace

* test(middleware/cors): add benchmarks

* chore: fix linter errors

* test(middleware/cors): use h() instead of app.Test()

* test(middleware/cors): add miltiple origins in Test_CORS_AllowOriginScheme

* chore: refactor validate and normalize

* test(cors/middleware): add more benchmarks

(cherry picked from commit d456e7d82ee087d5b2a5df5d4ab35f19c6397aae)
2024-03-01 13:30:40 +01:00
..
2024-02-29 08:29:59 +01:00
2024-01-04 09:44:45 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00
2024-02-29 08:29:59 +01:00