Skip to content

Commit a78d881

Browse files
committed
Update test for newer jackson
Newer versions redact the source by default for security so this picks out the important pieces in the error.
1 parent fe6cc43 commit a78d881

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

test/puppetlabs/ring_middleware/core_test.clj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,11 @@
796796

797797
(deftest wrap-json-parse-exception-handler-test
798798
(let [factory (JsonFactory.)
799-
wrapped-handler (core/wrap-json-parse-exception-handler (fn [_] (throw (JsonParseException. (.createParser factory "") "Error Message" ))))
799+
wrapped-handler (core/wrap-json-parse-exception-handler (fn [_] (throw (JsonParseException. (.createParser factory "") "Error Message"))))
800800
response (wrapped-handler (basic-request))]
801-
(is (= {:body "{\"kind\":\"json-parse-exception\",\"msg\":\"Error Message\\n at [Source: (String)\\\"\\\"; line: 1, column: 1]\"}"
802-
:headers {"Content-Type" "application/json; charset=utf-8"}
803-
:status 400}
804-
response))))
801+
(is (= 400 (:status response)))
802+
(is (= {"Content-Type" "application/json; charset=utf-8"} (:headers response)))
803+
(let [body (json/parse-string (:body response))]
804+
(is (= "json-parse-exception" (get body "kind")))
805+
(is (clojure.string/starts-with? (get body "msg") "Error Message"))
806+
(is (clojure.string/includes? (get body "msg") "line: 1, column: 1")))))

0 commit comments

Comments
 (0)