Skip to content

Commit

Permalink
Revert "Add default subprotocol header"
Browse files Browse the repository at this point in the history
This reverts commit d07c334.
  • Loading branch information
weavejester committed Oct 22, 2023
1 parent c615283 commit fa48658
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
4 changes: 1 addition & 3 deletions src/ring/websocket/transit.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions test/ring/websocket/transit_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fa48658

Please sign in to comment.