@faasjs/http 0.0.2-beta.289 → 0.0.2-beta.293
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.es.js +1 -6
- package/lib/index.js +1 -6
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Plugin, InvokeData, MountData, DeployData, Next, UseifyPlugin } from '@
|
|
|
2
2
|
import { Cookie, CookieOptions } from './cookie';
|
|
3
3
|
import { Session, SessionOptions } from './session';
|
|
4
4
|
import { Validator, ValidatorOptions, ValidatorRuleOptions, ValidatorConfig } from './validator';
|
|
5
|
-
export { Cookie, CookieOptions, Session, SessionOptions, Validator, ValidatorOptions, ValidatorRuleOptions };
|
|
5
|
+
export { Cookie, CookieOptions, Session, SessionOptions, Validator, ValidatorConfig, ValidatorOptions, ValidatorRuleOptions };
|
|
6
6
|
export declare const ContentType: {
|
|
7
7
|
[key: string]: string;
|
|
8
8
|
};
|
package/lib/index.es.js
CHANGED
|
@@ -296,7 +296,6 @@ class HttpError extends Error {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
const Name = 'http';
|
|
299
|
-
const globals = {};
|
|
300
299
|
class Http {
|
|
301
300
|
/**
|
|
302
301
|
* 创建 Http 插件实例
|
|
@@ -372,7 +371,6 @@ class Http {
|
|
|
372
371
|
this.logger.debug('[onMount] prepare validator');
|
|
373
372
|
this.validator = new Validator(this.validatorOptions, this.logger);
|
|
374
373
|
}
|
|
375
|
-
globals[this.name] = this;
|
|
376
374
|
await next();
|
|
377
375
|
}
|
|
378
376
|
async onInvoke(data, next) {
|
|
@@ -454,7 +452,7 @@ class Http {
|
|
|
454
452
|
// 处理 headers
|
|
455
453
|
this.response.headers = Object.assign({
|
|
456
454
|
'Content-Type': 'application/json; charset=utf-8',
|
|
457
|
-
'
|
|
455
|
+
'Cache-Control': 'no-cache, no-store'
|
|
458
456
|
}, this.cookie.headers(), this.response.headers);
|
|
459
457
|
data.response = this.response;
|
|
460
458
|
if (process.env.FaasMode === 'local') {
|
|
@@ -535,9 +533,6 @@ class Http {
|
|
|
535
533
|
}
|
|
536
534
|
}
|
|
537
535
|
function useHttp(config) {
|
|
538
|
-
const name = (config === null || config === void 0 ? void 0 : config.name) || Name;
|
|
539
|
-
if (process.env.FaasEnv !== 'testing' && globals[name])
|
|
540
|
-
return usePlugin(globals[name]);
|
|
541
536
|
return usePlugin(new Http(config));
|
|
542
537
|
}
|
|
543
538
|
|
package/lib/index.js
CHANGED
|
@@ -300,7 +300,6 @@ class HttpError extends Error {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
const Name = 'http';
|
|
303
|
-
const globals = {};
|
|
304
303
|
class Http {
|
|
305
304
|
/**
|
|
306
305
|
* 创建 Http 插件实例
|
|
@@ -376,7 +375,6 @@ class Http {
|
|
|
376
375
|
this.logger.debug('[onMount] prepare validator');
|
|
377
376
|
this.validator = new Validator(this.validatorOptions, this.logger);
|
|
378
377
|
}
|
|
379
|
-
globals[this.name] = this;
|
|
380
378
|
await next();
|
|
381
379
|
}
|
|
382
380
|
async onInvoke(data, next) {
|
|
@@ -458,7 +456,7 @@ class Http {
|
|
|
458
456
|
// 处理 headers
|
|
459
457
|
this.response.headers = Object.assign({
|
|
460
458
|
'Content-Type': 'application/json; charset=utf-8',
|
|
461
|
-
'
|
|
459
|
+
'Cache-Control': 'no-cache, no-store'
|
|
462
460
|
}, this.cookie.headers(), this.response.headers);
|
|
463
461
|
data.response = this.response;
|
|
464
462
|
if (process.env.FaasMode === 'local') {
|
|
@@ -539,9 +537,6 @@ class Http {
|
|
|
539
537
|
}
|
|
540
538
|
}
|
|
541
539
|
function useHttp(config) {
|
|
542
|
-
const name = (config === null || config === void 0 ? void 0 : config.name) || Name;
|
|
543
|
-
if (process.env.FaasEnv !== 'testing' && globals[name])
|
|
544
|
-
return func.usePlugin(globals[name]);
|
|
545
540
|
return func.usePlugin(new Http(config));
|
|
546
541
|
}
|
|
547
542
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/http",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.293",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"rollup-plugin-typescript2": "*",
|
|
27
27
|
"typescript": "*"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "e9f3f18f87e199d4d5d2fdee04225b993700018b"
|
|
30
30
|
}
|