postgrest 0.2.11.0 → 0.2.11.1
raw patch · 2 files changed
+7/−5 lines, 2 files
Files
- postgrest.cabal +1/−1
- src/PostgREST/App.hs +6/−4
postgrest.cabal view
@@ -2,7 +2,7 @@ description: Reads the schema of a PostgreSQL database and creates RESTful routes for the tables and views, supporting all HTTP verbs that security permits.-version: 0.2.11.0+version: 0.2.11.1 synopsis: REST API for any Postgres database license: MIT license-file: LICENSE
src/PostgREST/App.hs view
@@ -292,19 +292,21 @@ csvMT :: BS.ByteString csvMT = "text/csv" +allMT :: BS.ByteString+allMT = "*/*"+ jsonH :: Header jsonH = (hContentType, jsonMT) contentTypeForAccept :: Maybe BS.ByteString -> Maybe BS.ByteString contentTypeForAccept accept- | isNothing accept || hasJson = Just jsonMT- | hasCsv = Just csvMT+ | isNothing accept || has allMT || has jsonMT = Just jsonMT+ | has csvMT = Just csvMT | otherwise = Nothing where Just acceptH = accept findInAccept = flip find $ parseHttpAccept acceptH- hasJson = isJust $ findInAccept $ BS.isPrefixOf jsonMT- hasCsv = isJust $ findInAccept $ BS.isPrefixOf csvMT+ has = isJust . findInAccept . BS.isPrefixOf bodyForAccept :: BS.ByteString -> QualifiedIdentifier -> StatementT bodyForAccept contentType table