Simplify serialization of location header

Possible after bug fix in a Hasql that we picked up with the new
dependency bounds in #606. Also includes test to ensure location header
is omitted on bulk insert.
This commit is contained in:
Christopher League
2016-05-22 21:54:26 -04:00
parent 4f53aef74f
commit 0940b2dccf
3 changed files with 19 additions and 10 deletions
+10
View File
@@ -138,6 +138,16 @@ spec = do
JSON.decode (simpleBody r) `shouldBe` Just [expectedObj]
simpleStatus r `shouldBe` ok200
context "with bulk insert" $
it "returns 201 but no location header" $ do
let bulkData = [json| [ {"k1":21, "k2":"hello world"}
, {"k1":22, "k2":"bye for now"}]
|]
p <- request methodPost "/compound_pk" [] bulkData
liftIO $ do
simpleStatus p `shouldBe` created201
lookup hLocation (simpleHeaders p) `shouldBe` Nothing
context "with invalid json payload" $
it "fails with 400 and error" $
post "/simple_pk" "}{ x = 2" `shouldRespondWith` 400