raise InvalidBody when failing to decode the request body

This commit is contained in:
Alp Mestanogullari 2014-10-28 16:52:30 +01:00
parent 9ade9a43f3
commit 7ca6b26b78

View file

@ -26,7 +26,7 @@ instance (FromJSON a, HasServer sublayout)
route Proxy subserver request respond = do
mrqbody <- decode' <$> lazyRequestBody request
case mrqbody of
Nothing -> respond $ failWith NotFound
Nothing -> respond $ failWith InvalidBody
Just v -> route (Proxy :: Proxy sublayout) (subserver v) request respond
instance (ToJSON a, HasClient sublayout)