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 {
|
||||
corsConf := cors.Config{
|
||||
MaxAge: 12 * time.Hour,
|
||||
AllowBrowserExtensions: true,
|
||||
}
|
||||
if mode.IsDev() {
|
||||
corsConf.AllowAllOrigins = true
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ func TestCorsConfig(t *testing.T) {
|
|||
AllowHeaders: []string{"content-type"},
|
||||
AllowMethods: []string{"GET"},
|
||||
MaxAge: 12 * time.Hour,
|
||||
AllowBrowserExtensions: true,
|
||||
}, actual)
|
||||
assert.NotNil(t, allowF)
|
||||
assert.True(t, allowF("http://test.com"))
|
||||
|
|
@ -45,6 +46,7 @@ func TestEmptyCorsConfigWithResponseHeaders(t *testing.T) {
|
|||
AllowAllOrigins: false,
|
||||
AllowOrigins: []string{"https://example.com"},
|
||||
MaxAge: 12 * time.Hour,
|
||||
AllowBrowserExtensions: true,
|
||||
}, actual)
|
||||
}
|
||||
|
||||
|
|
@ -63,5 +65,6 @@ func TestDevCorsConfig(t *testing.T) {
|
|||
AllowMethods: []string{"GET", "POST", "DELETE", "OPTIONS", "PUT"},
|
||||
MaxAge: 12 * time.Hour,
|
||||
AllowAllOrigins: true,
|
||||
AllowBrowserExtensions: true,
|
||||
}, actual)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue