diff options
author | Valery Piashchynski <[email protected]> | 2021-05-31 23:59:52 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-05-31 23:59:52 +0300 |
commit | df4d316d519cea6dff654bd917521a616a37f769 (patch) | |
tree | 5cd2aaeeafdb50e3e46824197c721223f54695bf /plugins/websockets/plugin.go | |
parent | 648bed23ba9c8cff8d7937f5372b5e9ffc614769 (diff) |
- Add more ws tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/websockets/plugin.go')
-rw-r--r-- | plugins/websockets/plugin.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/websockets/plugin.go b/plugins/websockets/plugin.go index 8a15699e..9b21ff8f 100644 --- a/plugins/websockets/plugin.go +++ b/plugins/websockets/plugin.go @@ -179,8 +179,13 @@ func (p *Plugin) Middleware(next http.Handler) http.Handler { } if val.Status != http.StatusOK { - _, _ = w.Write(val.Body) + for k, v := range val.Header { + for i := 0; i < len(v); i++ { + w.Header().Add(k, v[i]) + } + } w.WriteHeader(val.Status) + _, _ = w.Write(val.Body) return } @@ -325,7 +330,7 @@ func (p *Plugin) defaultAccessValidator(pool phpPool.Pool) validator.AccessValid // if channels len is eq to 0, we use serverValidator if len(topics) == 0 { - ctx, err := validator.TopicsAccessValidator(r, topics...) + ctx, err := validator.ServerAccessValidator(r) if err != nil { return nil, errors.E(op, err) } @@ -338,7 +343,7 @@ func (p *Plugin) defaultAccessValidator(pool phpPool.Pool) validator.AccessValid return val, nil } - ctx, err := validator.ServerAccessValidator(r) + ctx, err := validator.TopicsAccessValidator(r, topics...) if err != nil { return nil, errors.E(op, err) } |