Skip to content

Commit

Permalink
refactor: special-resource-handler -> resource-handler-500
Browse files Browse the repository at this point in the history
  • Loading branch information
allentiak committed Nov 21, 2024
1 parent b102e49 commit f315918
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/rest-util/test/blaze/middleware/fhir/output_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@
(fn [_ respond _]
(respond (ring/status 200)))))

(defn- special-resource-handler [resource]
(wrap-output
(defn- common-handler-500 [wrapper-middleware resource]
(wrapper-middleware
(fn [_ respond _]
(respond (-> (ring/response resource)
(ring/status 500))))))

(defn- resource-handler-500 [resource]
(common-handler-500 wrap-output resource))

(defn- parse-json [body]
(fhir-spec/conform-json (fhir-spec/parse-json body)))

Expand Down Expand Up @@ -159,7 +162,7 @@
:body := nil))

(testing "failing XML emit"
(given (call (special-resource-handler {:fhir/type :fhir/Patient :id "0" :gender #fhir/code"foo\u001Ebar"}) {:headers {"accept" "application/fhir+xml"}})
(given (call (resource-handler-500 {:fhir/type :fhir/Patient :id "0" :gender #fhir/code"foo\u001Ebar"}) {:headers {"accept" "application/fhir+xml"}})
:status := 500
[:headers "Content-Type"] := "application/fhir+xml;charset=utf-8"
[:body parse-xml :fhir/type] := :fhir/OperationOutcome
Expand Down

0 comments on commit f315918

Please sign in to comment.