serverless-offline 9.1.5 → 9.1.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dedicatedTo": "Blue, a great migrating bird.",
3
3
  "name": "serverless-offline",
4
- "version": "9.1.5",
4
+ "version": "9.1.6",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "main": "./src/index.js",
@@ -79,11 +79,16 @@ export default class HttpServer {
79
79
  },
80
80
  }
81
81
 
82
- // HTTPS support
82
+ // https support
83
83
  if (typeof httpsProtocol === 'string' && httpsProtocol.length > 0) {
84
+ const [cert, key] = await Promise.all([
85
+ readFile(resolve(httpsProtocol, 'cert.pem'), 'utf-8'),
86
+ readFile(resolve(httpsProtocol, 'key.pem'), 'utf-8'),
87
+ ])
88
+
84
89
  serverOptions.tls = {
85
- cert: readFile(resolve(httpsProtocol, 'cert.pem'), 'ascii'),
86
- key: readFile(resolve(httpsProtocol, 'key.pem'), 'ascii'),
90
+ cert,
91
+ key,
87
92
  }
88
93
  }
89
94
 
@@ -103,7 +108,9 @@ export default class HttpServer {
103
108
  ? request.response.output
104
109
  : request.response
105
110
 
106
- const explicitlySetHeaders = { ...response.headers }
111
+ const explicitlySetHeaders = {
112
+ ...response.headers,
113
+ }
107
114
 
108
115
  if (
109
116
  this.#serverless.service.provider.httpApi &&
@@ -146,7 +146,10 @@ export default class LambdaProxyIntegrationEvent {
146
146
  const httpMethod = method.toUpperCase()
147
147
  const requestTime = formatToClfTime(received)
148
148
  const requestTimeEpoch = received
149
- const resource = this.#routeKey || route.path.replace(`/${this.#stage}`, '')
149
+ // NOTE replace * added by generateHapiPath util so api gateway event is accurate
150
+ const resource =
151
+ this.#routeKey ||
152
+ route.path.replace(`/${this.#stage}`, '').replace('*', '+')
150
153
 
151
154
  return {
152
155
  body,