Indicate input json parse error with better message

Fixes #42
This commit is contained in:
Joe Nelson
2014-10-14 19:23:56 -07:00
parent be2f1f8e9e
commit c163e2156c
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -68,6 +68,15 @@ spec = around appWithFixture $ do
matchHeaders = ["Location" <:> "/compound_pk?k1=eq.12&k2=eq.42"]
}
context "with invalid json payload" $
it "fails with 400 and error" $
post "/simple_pk" "}{ x = 2"
`shouldRespondWith` ResponseMatcher {
matchBody = Just [json| {"error":"Failed to parse JSON payload. Failed reading: satisfy"} |]
, matchStatus = 400
, matchHeaders = []
}
describe "Putting record" $ do
context "to unkonwn uri" $