@midwayjs/koa 3.15.8 → 3.15.11

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/dist/framework.js CHANGED
@@ -145,24 +145,28 @@ let MidwayKoaFramework = class MidwayKoaFramework extends core_1.BaseFramework {
145
145
  await this.loadMidwayController();
146
146
  // restore use method
147
147
  this.app.use = this.app.originUse;
148
+ const serverOptions = {
149
+ ...this.configurationOptions,
150
+ ...this.configurationOptions.serverOptions,
151
+ };
148
152
  // https config
149
- if (this.configurationOptions.key && this.configurationOptions.cert) {
150
- this.configurationOptions.key = core_1.PathFileUtil.getFileContentSync(this.configurationOptions.key);
151
- this.configurationOptions.cert = core_1.PathFileUtil.getFileContentSync(this.configurationOptions.cert);
152
- this.configurationOptions.ca = core_1.PathFileUtil.getFileContentSync(this.configurationOptions.ca);
153
- if (this.configurationOptions.http2) {
154
- this.server = require('http2').createSecureServer(this.configurationOptions, this.app.callback());
153
+ if (serverOptions.key && serverOptions.cert) {
154
+ serverOptions.key = core_1.PathFileUtil.getFileContentSync(serverOptions.key);
155
+ serverOptions.cert = core_1.PathFileUtil.getFileContentSync(serverOptions.cert);
156
+ serverOptions.ca = core_1.PathFileUtil.getFileContentSync(serverOptions.ca);
157
+ if (serverOptions.http2) {
158
+ this.server = require('http2').createSecureServer(serverOptions, this.app.callback());
155
159
  }
156
160
  else {
157
- this.server = require('https').createServer(this.configurationOptions, this.app.callback());
161
+ this.server = require('https').createServer(serverOptions, this.app.callback());
158
162
  }
159
163
  }
160
164
  else {
161
- if (this.configurationOptions.http2) {
162
- this.server = require('http2').createServer(this.app.callback());
165
+ if (serverOptions.http2) {
166
+ this.server = require('http2').createServer(serverOptions, this.app.callback());
163
167
  }
164
168
  else {
165
- this.server = require('http').createServer(this.app.callback());
169
+ this.server = require('http').createServer(serverOptions, this.app.callback());
166
170
  }
167
171
  }
168
172
  // register httpServer to applicationContext
@@ -76,6 +76,10 @@ export interface IMidwayKoaConfigurationOptions extends IConfigurationOptions {
76
76
  * @see https://nodejs.org/api/http.html#http_server_timeout
77
77
  */
78
78
  serverTimeout?: number;
79
+ /**
80
+ * https/https/http2 server options
81
+ */
82
+ serverOptions?: Record<string, any>;
79
83
  }
80
84
  export type MiddlewareParamArray = Array<Middleware<DefaultState, IMidwayKoaContext>>;
81
85
  export interface IWebMiddleware {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/koa",
3
- "version": "3.15.8",
3
+ "version": "3.15.11",
4
4
  "description": "Midway Web Framework for KOA",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -45,5 +45,5 @@
45
45
  "engines": {
46
46
  "node": ">=12"
47
47
  },
48
- "gitHead": "b9790dce4fac050c747893bc86dda0f044d827a9"
48
+ "gitHead": "5bf318ca3f6d27e46db173fe4af3a859a40a6c88"
49
49
  }