Merge pull request #662 from begriffs/raise-400
Translate raise_exception to http 400
This commit is contained in:
@@ -14,6 +14,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Fixed
|
||||
- Do not apply limit to parent items - @ruslantalpa
|
||||
|
||||
### Changed
|
||||
- Use HTTP 400 for raise\_exception - @begriffs
|
||||
|
||||
## [0.3.2.0] - 2016-06-10
|
||||
|
||||
### Added
|
||||
|
||||
@@ -86,6 +86,7 @@ httpStatus authed (P.SessionError (H.ResultError (H.ServerError c _ _ _))) =
|
||||
'5':'8':_ -> HT.status500 -- system error
|
||||
'F':'0':_ -> HT.status500 -- conf file error
|
||||
'H':'V':_ -> HT.status500 -- foreign data wrapper error
|
||||
"P0001" -> HT.status400 -- default code for "raise"
|
||||
'P':'0':_ -> HT.status500 -- PL/pgSQL Error
|
||||
'X':'X':_ -> HT.status500 -- internal Error
|
||||
"42P01" -> HT.status404 -- undefined table
|
||||
|
||||
@@ -512,7 +512,9 @@ spec = do
|
||||
-- it used to be 404 and it makes sense but in another part we decided that it's good to return
|
||||
-- PostgreSQL errors (and have the proxy handle them) and this saves us an aditional query on each rpc request
|
||||
it "responds with 400 on an unexisting proc" $
|
||||
post "/rpc/fake" [json| {} |] `shouldRespondWith` 400
|
||||
post "/rpc/fake" "{}" `shouldRespondWith` 400
|
||||
it "treats simple plpgsql raise as invalid input" $
|
||||
post "/rpc/problem" "{}" `shouldRespondWith` 400
|
||||
|
||||
|
||||
context "unsupported verbs" $ do
|
||||
|
||||
Reference in New Issue
Block a user