ali-api-gateway
Advanced tools
Comparing version 0.0.8 to 0.0.9
const Api = require('./src/api.js'); | ||
const http = require('./src/http'); | ||
const Router = require('./src/router.js'); | ||
module.exports = { | ||
Router: Router, | ||
http: http, | ||
Api: Api | ||
}; |
{ | ||
"name": "ali-api-gateway", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "proxy ali api gate way", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "https://github.com/JeremyWei/easy_mongo.git" | ||
"url": "" | ||
}, | ||
@@ -19,0 +19,0 @@ "author": "jinhai.wang", |
@@ -5,4 +5,9 @@ # v0.0.7 | ||
# v0.08(包含不兼容改动) | ||
# v0.0.8(包含不兼容改动) | ||
* 更改 this 为 ctx .更改下载文件方式。 | ||
# v0.0.9 | ||
* 添加 cookie 读取,和 setCookie api。 | ||
* 添加 setHeaders api。 |
@@ -5,2 +5,4 @@ 'use strict'; | ||
const parseFile = require('./parse-files.js'); | ||
const parseCookie = require('./parse-cookie.js'); | ||
const setHeaders = require('./set-headers.js'); | ||
const log = require('./log.js'); | ||
@@ -21,2 +23,4 @@ | ||
this.use(parseParams); | ||
this.use(setHeaders); | ||
this.use(parseCookie); | ||
this.use(log); | ||
@@ -23,0 +27,0 @@ if (this.options.parseFiles) { |
@@ -8,2 +8,4 @@ 'use strict'; | ||
const files = options.files || {}; | ||
const method = options.method || 'GET'; | ||
const funcName = options.funcName || 'test'; | ||
const event = { | ||
@@ -13,3 +15,3 @@ body: body, | ||
headers: headers, | ||
httpMethod: 'POST', | ||
httpMethod: method.toUpperCase(), | ||
isBase64Encoded: false, | ||
@@ -28,3 +30,3 @@ path: 'api-gateway/test', | ||
'function': { | ||
'name': 'test', | ||
'name': funcName, | ||
'handler': 'test.handler', | ||
@@ -31,0 +33,0 @@ 'memory': 128, |
@@ -36,5 +36,5 @@ 'use strict'; | ||
return { | ||
statusCode: err.code || 500, | ||
statusCode: isNaN(+err.code, NaN) ? 500 : err.code, | ||
body: {'error': err.message || 'server error'} | ||
}; | ||
}; |
@@ -16,3 +16,3 @@ 'use strict'; | ||
http(api.wrap(), {params: {test: 'test'}, body: {haha: 'haha'}}, function(err, res) { | ||
t.deepEqual(res, { headers: {}, encoding: 'utf8', statusCode: 200, body: 'test' }); | ||
t.deepEqual(res, { headers: {}, cookies: {}, encoding: 'utf8', statusCode: 200, body: 'test' }); | ||
t.end(); | ||
@@ -19,0 +19,0 @@ }); |
@@ -15,5 +15,5 @@ 'use strict'; | ||
http(api.wrap(), {files: {test: {data: new Buffer('test').toString('base64')}}}, function(err, res) { | ||
t.deepEqual(res, { headers: {}, encoding: 'utf8', statusCode: 200, body: 'test' }); | ||
t.deepEqual(res, { headers: {}, encoding: 'utf8', cookies: {}, statusCode: 200, body: 'test' }); | ||
t.end(); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18065
21
580
1