Skip to content

Commit 92d00fa

Browse files
author
Alex Thomas
committed
add unit tests
1 parent 4637472 commit 92d00fa

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/clj_http/test/client_test.clj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,26 @@
681681
{:accept-encoding [:identity :gzip]}
682682
{:headers {"accept-encoding" "identity, gzip"}}))
683683

684+
(deftest apply-custom-accept-encoding
685+
(testing "no custom encodings to accept"
686+
(is-applied (comp client/wrap-accept-encoding
687+
client/wrap-decompression)
688+
{}
689+
{:headers {"accept-encoding" "gzip, deflate"}
690+
:orig-content-encoding nil}))
691+
(testing "accept some custom encodings, but still include gzip and deflate"
692+
(is-applied (comp client/wrap-accept-encoding
693+
client/wrap-decompression)
694+
{:accept-encoding [:foo :bar]}
695+
{:headers {"accept-encoding" "foo, bar, gzip, deflate"}
696+
:orig-content-encoding nil}))
697+
(testing "accept some custom encodings, but exclude gzip and deflate"
698+
(is-applied (comp client/wrap-accept-encoding
699+
client/wrap-decompression)
700+
{:accept-encoding [:foo :bar] :decompress-body false}
701+
{:headers {"accept-encoding" "foo, bar"}
702+
:decompress-body false})))
703+
684704
(deftest pass-on-no-accept-encoding
685705
(is-passed client/wrap-accept-encoding
686706
{:uri "/foo"}))

0 commit comments

Comments
 (0)