ali-api-gateway
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "ali-api-gateway", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "proxy ali api gate way", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,6 +30,6 @@ 'use strict'; | ||
body: err.message || err || 'server error', | ||
cookies: ctx.cookies || {}, | ||
headers: ctx.headers || {} | ||
cookies: ctx.res.cookies || {}, | ||
headers: ctx.res.headers || {} | ||
}; | ||
}); | ||
}; |
@@ -37,9 +37,15 @@ 'use strict'; | ||
api.use(function *(ctx) { | ||
ctx.setHeaders('test', 'test'); | ||
ctx.setCookie('test', 'test'); | ||
throw ctx.newError(400, 'error params'); | ||
}); | ||
api.wrap()(new Buffer(JSON.stringify(Object.assign(basicEvent, {test: 'test'}))), Object.assign(basicContext, {haha: 'haha'}), function(err, res) { | ||
t.true(res.statusCode === 400); | ||
t.true(res.body === 'error params'); | ||
t.deepEqual(res, { | ||
statusCode: 400, | ||
body: 'error params', | ||
cookies: { test: 'test' }, | ||
headers: { test: '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
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
18561
592