diff --git a/src/ring/websocket/transit.clj b/src/ring/websocket/transit.clj index be1be71..bb9c523 100644 --- a/src/ring/websocket/transit.clj +++ b/src/ring/websocket/transit.clj @@ -52,9 +52,7 @@ are formatted using Transit. See: wrap-websocket-transit." [response] (if (contains? response :ring.websocket/listener) - (-> response - (update :ring.websocket/listener wrap-listener) - (update :ring.websocket/protocol #(or % "transit+json"))) + (update response :ring.websocket/listener wrap-listener) response)) (defn wrap-websocket-transit diff --git a/test/ring/websocket/transit_test.clj b/test/ring/websocket/transit_test.clj index b83ad2e..2fb6968 100644 --- a/test/ring/websocket/transit_test.clj +++ b/test/ring/websocket/transit_test.clj @@ -85,21 +85,6 @@ [:listener/ping :yyy] [:listener/error :eee]] @log)))) - (testing "subprotocol header set" - (let [handler (wst/wrap-websocket-transit - (fn [_] - {:ring.websocket/listener (reify wsp/Listener)})) - response (handler {})] - (is (= "transit+json" - (:ring.websocket/protocol response))))) - (testing "subprotocol header not overridden" - (let [handler (wst/wrap-websocket-transit - (fn [_] - {:ring.websocket/listener (reify wsp/Listener) - :ring.websocket/protocol "custom"})) - response (handler {})] - (is (= "custom" - (:ring.websocket/protocol response))))) (testing "parsing exceptions trigger on-error" (let [log (atom []) socket (reify wsp/Socket)