Fix Location link in post to db lacking a primary key

Fixes #29
This commit is contained in:
Joe Nelson
2014-09-07 14:12:51 -07:00
parent d166cbc371
commit 4d81959a2a
2 changed files with 11 additions and 1 deletions
+8
View File
@@ -50,6 +50,14 @@ spec = around appWithFixture $
post "/simple_pk" [json| { "extra":"foo"} |]
`shouldRespondWith` 400
context "into a table with no pk" $
it "succeeds with 201 and a link including all fields" $ do
p <- post "/no_pk" [json| { "a":"foo", "b":"bar" } |]
liftIO $ do
simpleBody p `shouldBe` ""
simpleHeaders p `shouldSatisfy` matchHeader hLocation "/no_pk\\?a=eq.foo&b=eq.bar"
simpleStatus p `shouldBe` created201
context "with compound pk supplied" $
it "builds response location header appropriately" $
post "/compound_pk" [json| { "k1":12, "k2":42 } |]