Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
593f247abb | ||
|
|
add63ac25b | ||
|
|
1ef8cc5048 | ||
|
|
c5836e0c9e | ||
|
|
922aa702a2 | ||
|
|
89c581816e |
@@ -3,6 +3,11 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [0.2.11.1] - 2015-09-01
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Accepts `*/*` in Accept header - @diogob
|
||||||
|
|
||||||
## [0.2.11.0] - 2015-08-28
|
## [0.2.11.0] - 2015-08-28
|
||||||
### Added
|
### Added
|
||||||
- Negate any filter in a uniform way, e.g. `?col=not.eq=foo` - @diogob
|
- Negate any filter in a uniform way, e.g. `?col=not.eq=foo` - @diogob
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"POSTGREST_VER": {
|
"POSTGREST_VER": {
|
||||||
"description": "Version of PostgREST to deploy",
|
"description": "Version of PostgREST to deploy",
|
||||||
"value": "0.2.11.0"
|
"value": "0.2.11.1"
|
||||||
},
|
},
|
||||||
"DB_NAME": {
|
"DB_NAME": {
|
||||||
"description": "Database name",
|
"description": "Database name",
|
||||||
@@ -41,6 +41,16 @@
|
|||||||
"description": "Maximum number of connections in database pool",
|
"description": "Maximum number of connections in database pool",
|
||||||
"required": false,
|
"required": false,
|
||||||
"value": "10"
|
"value": "10"
|
||||||
|
},
|
||||||
|
"JWT_SECRET": {
|
||||||
|
"description": "Secret used to encrypt JSON Web Tokens",
|
||||||
|
"required": false,
|
||||||
|
"value": "secret"
|
||||||
|
},
|
||||||
|
"V1SCHEMA": {
|
||||||
|
"description": "DB schema selected whe no version (or version 1) requested",
|
||||||
|
"required": false,
|
||||||
|
"value": "1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ name: postgrest
|
|||||||
description: Reads the schema of a PostgreSQL database and creates RESTful routes
|
description: Reads the schema of a PostgreSQL database and creates RESTful routes
|
||||||
for the tables and views, supporting all HTTP verbs that security
|
for the tables and views, supporting all HTTP verbs that security
|
||||||
permits.
|
permits.
|
||||||
version: 0.2.11.0
|
version: 0.2.11.1
|
||||||
synopsis: REST API for any Postgres database
|
synopsis: REST API for any Postgres database
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export POSTGREST_VER=`grep ^version /app/postgrest.cabal | sed -En 's/.*\s+([0-9\.]+)/\1/p'`
|
export POSTGREST_VER=`grep ^version /app/postgrest.cabal | sed -En 's/.*\s+([0-9\.]+)/\1/p'`
|
||||||
|
|
||||||
curl -L http://softlayer-ams.dl.sourceforge.net/project/s3tools/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz | tar zx
|
curl -L http://sourceforge.net/projects/s3tools/files/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz | tar zx
|
||||||
|
|
||||||
cp /app/dist/build/postgrest/postgrest postgrest-${POSTGREST_VER}
|
cp /app/dist/build/postgrest/postgrest postgrest-${POSTGREST_VER}
|
||||||
tar cJf postgrest-${POSTGREST_VER}.tar.xz postgrest-${POSTGREST_VER}
|
tar cJf postgrest-${POSTGREST_VER}.tar.xz postgrest-${POSTGREST_VER}
|
||||||
|
|||||||
@@ -292,19 +292,21 @@ jsonMT = "application/json"
|
|||||||
csvMT :: BS.ByteString
|
csvMT :: BS.ByteString
|
||||||
csvMT = "text/csv"
|
csvMT = "text/csv"
|
||||||
|
|
||||||
|
allMT :: BS.ByteString
|
||||||
|
allMT = "*/*"
|
||||||
|
|
||||||
jsonH :: Header
|
jsonH :: Header
|
||||||
jsonH = (hContentType, jsonMT)
|
jsonH = (hContentType, jsonMT)
|
||||||
|
|
||||||
contentTypeForAccept :: Maybe BS.ByteString -> Maybe BS.ByteString
|
contentTypeForAccept :: Maybe BS.ByteString -> Maybe BS.ByteString
|
||||||
contentTypeForAccept accept
|
contentTypeForAccept accept
|
||||||
| isNothing accept || hasJson = Just jsonMT
|
| isNothing accept || has allMT || has jsonMT = Just jsonMT
|
||||||
| hasCsv = Just csvMT
|
| has csvMT = Just csvMT
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
where
|
where
|
||||||
Just acceptH = accept
|
Just acceptH = accept
|
||||||
findInAccept = flip find $ parseHttpAccept acceptH
|
findInAccept = flip find $ parseHttpAccept acceptH
|
||||||
hasJson = isJust $ findInAccept $ BS.isPrefixOf jsonMT
|
has = isJust . findInAccept . BS.isPrefixOf
|
||||||
hasCsv = isJust $ findInAccept $ BS.isPrefixOf csvMT
|
|
||||||
|
|
||||||
bodyForAccept :: BS.ByteString -> QualifiedIdentifier -> StatementT
|
bodyForAccept :: BS.ByteString -> QualifiedIdentifier -> StatementT
|
||||||
bodyForAccept contentType table
|
bodyForAccept contentType table
|
||||||
|
|||||||
@@ -184,6 +184,11 @@ spec =
|
|||||||
(acceptHdrs "text/unknowntype") ""
|
(acceptHdrs "text/unknowntype") ""
|
||||||
`shouldRespondWith` 415
|
`shouldRespondWith` 415
|
||||||
|
|
||||||
|
it "should respond correctly to */* in accept header" $
|
||||||
|
request methodGet "/simple_pk"
|
||||||
|
(acceptHdrs "*/*") ""
|
||||||
|
`shouldRespondWith` 200
|
||||||
|
|
||||||
it "should respond correctly to multiple types in accept header" $
|
it "should respond correctly to multiple types in accept header" $
|
||||||
request methodGet "/simple_pk"
|
request methodGet "/simple_pk"
|
||||||
(acceptHdrs "text/unknowntype, text/csv") ""
|
(acceptHdrs "text/unknowntype, text/csv") ""
|
||||||
|
|||||||
Reference in New Issue
Block a user