Issue http 405 for anything but POST on RPC

Fixes #481
This commit is contained in:
Joe Nelson
2016-02-01 22:52:57 -08:00
parent aec11e34a7
commit a0ef4eae4d
4 changed files with 13 additions and 2 deletions
+2 -1
View File
@@ -31,6 +31,7 @@ data Action = ActionCreate | ActionRead
| ActionUnknown BS.ByteString deriving Eq
-- | The target db object of a user action
data Target = TargetIdent QualifiedIdentifier
| TargetProc QualifiedIdentifier
| TargetRoot
| TargetUnknown [T.Text]
-- | How to return the inserted data
@@ -90,7 +91,7 @@ userApiRequest schema req reqBody =
[] -> TargetRoot
[table] -> TargetIdent
$ QualifiedIdentifier schema table
["rpc", proc] -> TargetIdent
["rpc", proc] -> TargetProc
$ QualifiedIdentifier schema proc
other -> TargetUnknown other
payload = case pickContentType (lookupHeader "content-type") of
+3 -1
View File
@@ -155,7 +155,7 @@ app dbStructure conf reqBody req =
filterCol _ _ _ = False
return $ responseLBS status200 [jsonH, allOrigins] $ cs body
(ActionInvoke, TargetIdent qi,
(ActionInvoke, TargetProc qi,
Just (PayloadJSON (UniformObjects payload))) -> do
exists <- H.query qi doesProcExist
if exists
@@ -178,6 +178,8 @@ app dbStructure conf reqBody req =
(ActionUnknown _, _, _) -> return notFound
(_, TargetProc _, _) -> return $ responseLBS status405 [] ""
(_, TargetUnknown _, _) -> return notFound
(_, _, Just (PayloadParseError e)) ->