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)
|
||||
else redirect r
|
||||
where
|
||||
acceptsJson = maybe False ("application/json" `B.isPrefixOf`) <$> firstAccept
|
||||
firstAccept = return . join
|
||||
acceptsJson = maybe False ("application/json" `B.isPrefixOf`)
|
||||
. join
|
||||
. fmap (headMay . parseHttpAccept)
|
||||
=<< lookup "Accept" . requestHeaders <$> waiRequest
|
||||
. lookup "Accept" . requestHeaders
|
||||
<$> waiRequest
|
||||
|
||||
Loading…
Reference in New Issue
Block a user