Fix location header for inserted objects with nulls

This commit is contained in:
Joe Nelson
2015-03-15 18:26:32 -07:00
parent ddb5ba8b64
commit 42d3d0de6c
4 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ app v1schema reqBody req =
then inserted
else filterWithKey (const . (`elem` primaryKeys)) inserted
let params = urlEncodeVars
$ map (\t -> (cs $ fst t, "eq." <> cs (unquoted $ snd t)))
$ map (\t -> (cs $ fst t, cs (paramFilter $ snd t)))
$ sortBy (comparing fst) $ toList primaries
return $ responseLBS status201
[ jsonH
+4
View File
@@ -237,3 +237,7 @@ unquoted _ = ""
insertableValue :: JSON.Value -> T.Text
insertableValue JSON.Null = "null"
insertableValue v = ((<> "::unknown") . pgFmtLit . unquoted) v
paramFilter :: JSON.Value -> T.Text
paramFilter JSON.Null = "is.null"
paramFilter v = "eq." <> unquoted v