mirror of https://github.com/gofiber/fiber.git
* 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
|
||
---|---|---|
.. | ||
adaptor | ||
basicauth | ||
cache | ||
compress | ||
cors | ||
csrf | ||
earlydata | ||
encryptcookie | ||
envvar | ||
etag | ||
expvar | ||
favicon | ||
filesystem | ||
healthcheck | ||
helmet | ||
idempotency | ||
keyauth | ||
limiter | ||
logger | ||
pprof | ||
proxy | ||
recover | ||
redirect | ||
requestid | ||
rewrite | ||
session | ||
skip | ||
timeout |