Allows browser extensions in cors (#317)
This commit is contained in:
parent
7523ad0d2e
commit
93b30c5c44
|
|
@ -14,6 +14,7 @@ import (
|
||||||
func CorsConfig(conf *config.Configuration) cors.Config {
|
func CorsConfig(conf *config.Configuration) cors.Config {
|
||||||
corsConf := cors.Config{
|
corsConf := cors.Config{
|
||||||
MaxAge: 12 * time.Hour,
|
MaxAge: 12 * time.Hour,
|
||||||
|
AllowBrowserExtensions: true,
|
||||||
}
|
}
|
||||||
if mode.IsDev() {
|
if mode.IsDev() {
|
||||||
corsConf.AllowAllOrigins = true
|
corsConf.AllowAllOrigins = true
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ func TestCorsConfig(t *testing.T) {
|
||||||
AllowHeaders: []string{"content-type"},
|
AllowHeaders: []string{"content-type"},
|
||||||
AllowMethods: []string{"GET"},
|
AllowMethods: []string{"GET"},
|
||||||
MaxAge: 12 * time.Hour,
|
MaxAge: 12 * time.Hour,
|
||||||
|
AllowBrowserExtensions: true,
|
||||||
}, actual)
|
}, actual)
|
||||||
assert.NotNil(t, allowF)
|
assert.NotNil(t, allowF)
|
||||||
assert.True(t, allowF("http://test.com"))
|
assert.True(t, allowF("http://test.com"))
|
||||||
|
|
@ -45,6 +46,7 @@ func TestEmptyCorsConfigWithResponseHeaders(t *testing.T) {
|
||||||
AllowAllOrigins: false,
|
AllowAllOrigins: false,
|
||||||
AllowOrigins: []string{"https://example.com"},
|
AllowOrigins: []string{"https://example.com"},
|
||||||
MaxAge: 12 * time.Hour,
|
MaxAge: 12 * time.Hour,
|
||||||
|
AllowBrowserExtensions: true,
|
||||||
}, actual)
|
}, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,5 +65,6 @@ func TestDevCorsConfig(t *testing.T) {
|
||||||
AllowMethods: []string{"GET", "POST", "DELETE", "OPTIONS", "PUT"},
|
AllowMethods: []string{"GET", "POST", "DELETE", "OPTIONS", "PUT"},
|
||||||
MaxAge: 12 * time.Hour,
|
MaxAge: 12 * time.Hour,
|
||||||
AllowAllOrigins: true,
|
AllowAllOrigins: true,
|
||||||
|
AllowBrowserExtensions: true,
|
||||||
}, actual)
|
}, actual)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue