Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ali-api-gateway

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ali-api-gateway - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

src/parse-cookie.js

2

index.js
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
};

4

package.json
{
"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();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc