More docs for pickContentType
This commit is contained in:
@@ -112,8 +112,14 @@ userIntent schema req reqBody =
|
|||||||
|
|
||||||
-- PRIVATE ---------------------------------------------------------------
|
-- PRIVATE ---------------------------------------------------------------
|
||||||
|
|
||||||
-- | Chooses a payload from the items in an accept header.
|
-- | Picks a preferred content type from an Accept header (or from
|
||||||
-- When possible it picks JSON.
|
-- Content-Type as a degenerate case).
|
||||||
|
--
|
||||||
|
-- For example
|
||||||
|
-- text/csv -> TextCSV
|
||||||
|
-- */* -> ApplicationJSON
|
||||||
|
-- text/csv, application/json -> TextCSV
|
||||||
|
-- application/json, text/csv -> ApplicationJSON
|
||||||
pickContentType :: Maybe BS.ByteString -> Either BS.ByteString ContentType
|
pickContentType :: Maybe BS.ByteString -> Either BS.ByteString ContentType
|
||||||
pickContentType accept
|
pickContentType accept
|
||||||
| isNothing accept || has ctAll || has ctJson = Right ApplicationJSON
|
| isNothing accept || has ctAll || has ctJson = Right ApplicationJSON
|
||||||
|
|||||||
Reference in New Issue
Block a user