fix: Location header with a null PK on a view (#1875)

Regression after #1475
This commit is contained in:
laurenceisla
2021-06-18 18:09:19 -05:00
committed by GitHub
parent 1b12b112a1
commit 59e0b006a5
4 changed files with 35 additions and 2 deletions
+11 -1
View File
@@ -527,7 +527,7 @@ spec actualPgVersion = do
, matchHeaders = [ matchHeaderAbsent hLocation ]
}
context "requesting header only representation" $
context "requesting header only representation" $ do
it "returns a location header" $
request methodPost "/compound_pk_view" [("Prefer", "return=headers-only")]
[json|{"k1":1,"k2":"test","extra":2}|]
@@ -537,3 +537,13 @@ spec actualPgVersion = do
, matchHeaders = [ "Location" <:> "/compound_pk_view?k1=eq.1&k2=eq.test"
, "Content-Range" <:> "*/*" ]
}
it "should not throw and return location header when a PK is null" $
request methodPost "/test_null_pk_competitors_sponsors" [("Prefer", "return=headers-only")]
[json|{"id":1}|]
`shouldRespondWith`
""
{ matchStatus = 201
, matchHeaders = [ "Location" <:> "/test_null_pk_competitors_sponsors?id=eq.1&sponsor_id=is.null"
, "Content-Range" <:> "*/*" ]
}