Skip to content

Commit

Permalink
Add test for comma separated header and numeric value as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Pizzo committed Jun 2, 2023
1 parent cd406d7 commit 278abe9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/hato/client_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,16 @@
"content-type" "application/json"}
:body (json/generate-string
(-> (:headers req)
(select-keys ["a" "b"])
(select-keys ["a" "b" "c" "d"])
;; ring spec will take multi value headers as a comma separated string.
(update "b" #(str/split % #","))))})
(let [response (get "http://localhost:1234" {:headers {"a" "single"
"b" ["1" "2"]}
"b" ["1" "2"]
"c" "1,2"
"d" 123}
:as :json})]
(is (= {"content-type" "application/json"
"foo" ["bar" "baz"]}
(select-keys (:headers response) ["foo" "content-type"])))
(is (= {:a "single" :b ["1" "2"]}
(is (= {:a "single" :b ["1" "2"] :c "1,2" :d "123"}
(:body response)))))))

0 comments on commit 278abe9

Please sign in to comment.