diff options
author | Valery Piashchynski <[email protected]> | 2021-06-21 08:49:47 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-21 08:49:47 +0300 |
commit | 591b69be9279158cfe9e7083152d308c4ee480b7 (patch) | |
tree | 5c6b1d4ee2aea4e6a1cc828ca1fcb2306ef9741e /plugins/websockets/origin_test.go | |
parent | 25e0841c6aa5e2686da5b9f74e3d77d3814ff592 (diff) | |
parent | 2ab22ac9e935efb126b51e9c3521073e6a5155a1 (diff) |
#732 feat(plugin): rework `broadcast` plugin
#732 feat(plugin): rework `broadcast` plugin
Diffstat (limited to 'plugins/websockets/origin_test.go')
-rw-r--r-- | plugins/websockets/origin_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/websockets/origin_test.go b/plugins/websockets/origin_test.go index e877fad3..bbc49bbb 100644 --- a/plugins/websockets/origin_test.go +++ b/plugins/websockets/origin_test.go @@ -9,9 +9,11 @@ import ( func TestConfig_Origin(t *testing.T) { cfg := &Config{ AllowedOrigin: "*", + Broker: "any", } - cfg.InitDefault() + err := cfg.InitDefault() + assert.NoError(t, err) assert.True(t, isOriginAllowed("http://some.some.some.sssome", cfg)) assert.True(t, isOriginAllowed("http://", cfg)) @@ -27,9 +29,11 @@ func TestConfig_Origin(t *testing.T) { func TestConfig_OriginWildCard(t *testing.T) { cfg := &Config{ AllowedOrigin: "https://*my.site.com", + Broker: "any", } - cfg.InitDefault() + err := cfg.InitDefault() + assert.NoError(t, err) assert.True(t, isOriginAllowed("https://my.site.com", cfg)) assert.False(t, isOriginAllowed("http://", cfg)) @@ -48,9 +52,11 @@ func TestConfig_OriginWildCard(t *testing.T) { func TestConfig_OriginWildCard2(t *testing.T) { cfg := &Config{ AllowedOrigin: "https://my.*.com", + Broker: "any", } - cfg.InitDefault() + err := cfg.InitDefault() + assert.NoError(t, err) assert.True(t, isOriginAllowed("https://my.site.com", cfg)) assert.False(t, isOriginAllowed("http://", cfg)) |