Skip to content

Commit

Permalink
Update Jetty test to not use deprecated setGzipHandler method
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Mar 22, 2024
1 parent 6180708 commit a831bcf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/test/io/pedestal/http/jetty_util_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
[clj-http.client :as http]
[io.pedestal.http.jetty.util :as jetty-util]
[io.pedestal.http.jetty-test :as test-util])
(:import (org.eclipse.jetty.servlets DoSFilter)
(:import (org.eclipse.jetty.servlet ServletContextHandler)
(org.eclipse.jetty.servlets DoSFilter)
(org.eclipse.jetty.server.handler.gzip GzipHandler)))

;; NOTE:
Expand All @@ -26,13 +27,13 @@
(deftest simple-gzip-handler
(testing "A Simple GZip Handler"
(test-util/with-server test-util/hello-world {:port 4347
:container-options {:context-configurator (fn [c]
:container-options {:context-configurator (fn [ ^ServletContextHandler c]
(let [gzip-handler (GzipHandler.)]
(.setGzipHandler c gzip-handler)
(.insertHandler c gzip-handler)
c))}}
(let [response (http/get "http://localhost:4347")]
(is (= (:status response) 200))
(is (.startsWith ^String (get-in response [:headers "content-type"])
(let [response (http/get "http://localhost:4347")]
(is (= (:status response) 200))
(is (.startsWith ^String (get-in response [:headers "content-type"])
"text/plain"))
(is (.startsWith ^String (:orig-content-encoding response) "gzip"))
(is (= (:body response) "Hello World"))))))
Expand Down

0 comments on commit a831bcf

Please sign in to comment.