Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
allentiak committed Oct 22, 2024
1 parent 2abc9ed commit 7bd0273
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions modules/rest-util/test/blaze/middleware/fhir/output_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
(fn [_ respond _]
(respond (ring/response {:fhir/type :fhir/Patient :id "0"})))))

(defn binary-resource-handler-200
"A handler which uses the binary middleware and just returns
a binary resource."
(defn- binary-resource-handler-200
"A handler which uses the binary middleware and
returns a binary resource."
[{:keys [content-type data] :as _body}]
(wrap-binary-output
(fn [_ respond _]
Expand All @@ -47,6 +47,13 @@
(fn [_ respond _]
(respond (ring/status 304)))))

(def ^:private binary-resource-handler-304
"A handler which uses the binary middleware and
returns a 304 Not Modified response."
(wrap-binary-output
(fn [_ respond _]
(respond (ring/status 304)))))

(defn- special-resource-handler [resource]
(wrap-output
(fn [_ respond _]
Expand Down Expand Up @@ -211,6 +218,7 @@

(testing "not modified"
(given (call resource-handler-304 {:headers {"accept" "application/fhir+xml"}})
:status := 304
[:headers "Content-Type"] := nil
:body := nil))

Expand Down Expand Up @@ -246,9 +254,9 @@
:body := nil))

(testing "without body at all"
(given (call (binary-resource-handler-200 nil) {:headers {"accept" "text/plain"}})
:status := 200
[:headers "Content-Type"] := "application/octet-stream"
(given (call binary-resource-handler-304 {:headers {"accept" "text/plain"}})
:status := 304
[:headers "Content-Type"] := nil
:body := nil)))

(deftest not-acceptable-test
Expand Down

0 comments on commit 7bd0273

Please sign in to comment.