File tree Expand file tree Collapse file tree
test/puppetlabs/ring_middleware Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" )))))
You can’t perform that action at this time.
0 commit comments