Small refactor to jsonOrRedirect
This commit is contained in:
parent
c6a08f0c4a
commit
b2c715f223
@ -119,7 +119,8 @@ jsonOrRedirect r j = do
|
|||||||
if q then jsonToRepJson (J.toJSON j)
|
if q then jsonToRepJson (J.toJSON j)
|
||||||
else redirect r
|
else redirect r
|
||||||
where
|
where
|
||||||
acceptsJson = maybe False ("application/json" `B.isPrefixOf`) <$> firstAccept
|
acceptsJson = maybe False ("application/json" `B.isPrefixOf`)
|
||||||
firstAccept = return . join
|
. join
|
||||||
. fmap (headMay . parseHttpAccept)
|
. fmap (headMay . parseHttpAccept)
|
||||||
=<< lookup "Accept" . requestHeaders <$> waiRequest
|
. lookup "Accept" . requestHeaders
|
||||||
|
<$> waiRequest
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user