Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge 1.6.x to master #82

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js
node_js:
- '0.12'
- '4'
- '5.8'
- '6'
before_install:
- npm config set registry=http://apim-ci1.rtp.raleigh.ibm.com:4873/

Expand Down
37 changes: 37 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
2018-06-12, Version 1.6.8
=========================

* Update node engine to 6 at minimal

2018-03-07, Version 1.6.7
=========================

* Check existence of the env.yaml file

2017-10-26, Version 1.6.6
=========================

* Update shrinkwrap (Ryan Graham)

2017-10-26, Version 1.6.5
=========================

* Update shrinkwrap (Gary Tu)

2017-10-12, Version 1.6.4
=========================

* Add sub-type for the loopback model (Gary Tu)

2017-04-03, Version 1.6.3
=========================

* Fix DBCS issue (#63) (Jeremy Geddes)


2016-12-13, Version 1.6.2
=========================

* add shrinkwrap (Joseph Tary)


2016-12-06, Version 1.6.1
=========================

Expand Down
18 changes: 9 additions & 9 deletions datastore/common/models/optimizedData.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"catalog-name": "string",
"organization-id": "string",
"organization-name": "string",
"space-ids": [],
"space-ids": ["string"],
"product-id": "string",
"product-name": "string",
"plan-id": "string",
"plan-name": "string",
"plan-version": "string",
"plan-rate-limit": [],
"plan-rate-limit": [{}],
"api-id": "string",
"api-document": {},
"api-document-resolved": {},
Expand All @@ -39,23 +39,23 @@
"path-regex": "string",
"matching-score": "number",
"path-methods": [{
"consumes": [],
"consumes": ["string"],
"method": "string",
"operationId": "string",
"parameters": [],
"produces": [],
"parameters": [{}],
"produces": ["string"],
"responses": {},
"securityDefs": {},
"securityReqs": [],
"observed-rate-limit": [],
"securityReqs": [{}],
"observed-rate-limit": [{}],
"rate-limit-scope": "string"
}]
}],
"api-state": "string",
"snapshot-id": "string"
},
"validations": [],
"validations": [{}],
"relations": {},
"acls": [],
"acls": [{}],
"methods": {}
}
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// US Government Users Restricted Rights - Use, duplication or disclosure
// restricted by GSA ADP Schedule Contract with IBM Corp.

var fs = require('fs');
var path = require('path');
var YAML = require('yamljs');
var logger = require('apiconnect-cli-logger/logger.js')
Expand All @@ -15,10 +16,15 @@ var env = {
APIMANAGER_REFRESH_INTERVAL: 15 * 1000 * 60 };

try {
var envjson = YAML.load(path.join(__dirname, '/env.yaml'));
Object.keys(envjson).forEach(function(k) {
env[k] = envjson[k];
});
var envPath = path.join(__dirname, '/env.yaml');
if (!fs.existsSync(envPath)) {
logger.warn('File not exist: env.yaml');
} else {
var envjson = YAML.load(envPath);
Object.keys(envjson).forEach(function(k) {
env[k] = envjson[k];
});
}
} catch (e) {
logger.error('Fail to load environment variables: ', e);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/postflow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ module.exports = function createPostFlowMiddleware(options) {
// Check if chunked mode is set
if (transferEncoding !== 'chunked') {
if (body) {
res.set('Content-Length', body.length);
// need to get buffer length, not just length (DBCS consideration)
res.set('Content-Length', Buffer.byteLength(body, 'utf8'));
} else {
res.set('Content-Length', 0);
}
Expand All @@ -81,4 +82,3 @@ module.exports = function createPostFlowMiddleware(options) {
});
};
};