Merge pull request #1267 from hotwirestudios/master
Added support for aeson's toEncoding function (>= 0.11) to sendStatusJSON
This commit is contained in:
commit
4a5f4ab0e9
@ -615,10 +615,14 @@ sendResponseStatus s = handlerError . HCContent s . toTypedContent
|
|||||||
|
|
||||||
-- | Bypass remaining handler code and output the given JSON with the given
|
-- | Bypass remaining handler code and output the given JSON with the given
|
||||||
-- status code.
|
-- status code.
|
||||||
--
|
--
|
||||||
-- Since 1.4.18
|
-- Since 1.4.18
|
||||||
sendStatusJSON :: (MonadHandler m, ToJSON c) => H.Status -> c -> m a
|
sendStatusJSON :: (MonadHandler m, ToJSON c) => H.Status -> c -> m a
|
||||||
|
#if MIN_VERSION_aeson(0, 11, 0)
|
||||||
|
sendStatusJSON s v = sendResponseStatus s (toEncoding v)
|
||||||
|
#else
|
||||||
sendStatusJSON s v = sendResponseStatus s (toJSON v)
|
sendStatusJSON s v = sendResponseStatus s (toJSON v)
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | Send a 201 "Created" response with the given route as the Location
|
-- | Send a 201 "Created" response with the given route as the Location
|
||||||
-- response header.
|
-- response header.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user