Skip to content

Commit

Permalink
test: add test for wrap-jetty-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Apr 2, 2024
1 parent e44b1a8 commit 2dde928
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/ring/adapter/jetty9_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,26 @@
(is (= 200 (:status resp)))
(is (= "yes" (:body resp))))))

(deftest wrap-jetty-handler-test
(let [counter (atom 0)]
(with-jetty [server [(test-app-maker {:request-method :post
:content-type "text/plain"
:content-length 6})
{:port 50524
:join? false
:wrap-jetty-handler (fn [handler]
(proxy [org.eclipse.jetty.server.Handler$Abstract] []
(handle [req resp cb]
(swap! counter inc)
(.handle handler req resp cb))))}]]
(is server)
(let [resp (client/post "http://localhost:50524/"
{:body "tomcat"
:content-type "text/plain"})]
(is (= 200 (:status resp)))
(is (= "yes" (:body resp)))
(is (= 1 @counter))))))

#_(deftest jetty9-websocket-test
(with-jetty [server [(fn [req]
{:ring.websocket/listener websocket-handler})
Expand Down

0 comments on commit 2dde928

Please sign in to comment.