From fa486583042426b865b595daf3e49b02d55af75c Mon Sep 17 00:00:00 2001 From: James Reeves Date: Sun, 22 Oct 2023 02:17:03 +0100 Subject: [PATCH] Revert "Add default subprotocol header" This reverts commit d07c3349d87b00878a10c01a2257a0bafaa7ebc8. --- src/ring/websocket/transit.clj | 4 +--- test/ring/websocket/transit_test.clj | 15 --------------- 2 files changed, 1 insertion(+), 18 deletions(-) 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)