mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-16 02:52:45 +00:00
parent
497eb02b48
commit
b634ba0a58
@ -112,11 +112,11 @@ func New(config ...Config) fiber.Handler {
|
||||
|
||||
// Check allowed origins
|
||||
for _, o := range allowOrigins {
|
||||
if o == "*" && cfg.AllowCredentials {
|
||||
allowOrigin = origin
|
||||
if o == "*" {
|
||||
allowOrigin = "*"
|
||||
break
|
||||
}
|
||||
if o == "*" || o == origin {
|
||||
if o == origin {
|
||||
allowOrigin = o
|
||||
break
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ func Test_CORS_Wildcard(t *testing.T) {
|
||||
handler(ctx)
|
||||
|
||||
// Check result
|
||||
utils.AssertEqual(t, "localhost", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowOrigin)))
|
||||
utils.AssertEqual(t, "*", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowOrigin)))
|
||||
utils.AssertEqual(t, "true", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowCredentials)))
|
||||
utils.AssertEqual(t, "3600", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlMaxAge)))
|
||||
utils.AssertEqual(t, "Authentication", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowHeaders)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user