serverless-offline 12.0.1 → 12.0.3
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": "12.0.
|
|
4
|
+
"version": "12.0.3",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -82,13 +82,14 @@
|
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@aws-sdk/client-lambda": "^3.
|
|
85
|
+
"@aws-sdk/client-lambda": "^3.231.0",
|
|
86
86
|
"@hapi/boom": "^10.0.0",
|
|
87
87
|
"@hapi/h2o2": "^10.0.0",
|
|
88
88
|
"@hapi/hapi": "^21.1.0",
|
|
89
89
|
"@serverless/utils": "^6.8.2",
|
|
90
|
+
"array-unflat-js": "^0.1.0",
|
|
90
91
|
"boxen": "^7.0.0",
|
|
91
|
-
"chalk": "^5.
|
|
92
|
+
"chalk": "^5.2.0",
|
|
92
93
|
"execa": "^6.1.0",
|
|
93
94
|
"fs-extra": "^11.1.0",
|
|
94
95
|
"is-wsl": "^2.2.0",
|
|
@@ -110,7 +111,7 @@
|
|
|
110
111
|
"devDependencies": {
|
|
111
112
|
"@istanbuljs/esm-loader-hook": "^0.2.0",
|
|
112
113
|
"archiver": "^5.3.1",
|
|
113
|
-
"eslint": "^8.
|
|
114
|
+
"eslint": "^8.30.0",
|
|
114
115
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
115
116
|
"eslint-config-prettier": "^8.5.0",
|
|
116
117
|
"eslint-plugin-import": "^2.25.4",
|
|
@@ -118,9 +119,9 @@
|
|
|
118
119
|
"git-list-updated": "^1.2.1",
|
|
119
120
|
"husky": "^8.0.2",
|
|
120
121
|
"lint-staged": "^13.1.0",
|
|
121
|
-
"mocha": "^10.
|
|
122
|
+
"mocha": "^10.2.0",
|
|
122
123
|
"nyc": "^15.1.0",
|
|
123
|
-
"prettier": "^2.8.
|
|
124
|
+
"prettier": "^2.8.1",
|
|
124
125
|
"serverless": "^3.25.1",
|
|
125
126
|
"standard-version": "^9.5.0"
|
|
126
127
|
},
|
|
@@ -22,8 +22,6 @@ export default class HttpServer {
|
|
|
22
22
|
|
|
23
23
|
#server = null
|
|
24
24
|
|
|
25
|
-
#lastRequestOptions = null
|
|
26
|
-
|
|
27
25
|
#terminalInfo = []
|
|
28
26
|
|
|
29
27
|
constructor(serverless, options, lambda) {
|
|
@@ -140,7 +138,7 @@ export default class HttpServer {
|
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
async start() {
|
|
143
|
-
const {
|
|
141
|
+
const { albPort, host, httpsProtocol } = this.#options
|
|
144
142
|
|
|
145
143
|
try {
|
|
146
144
|
await this.#server.start()
|
|
@@ -172,13 +170,6 @@ export default class HttpServer {
|
|
|
172
170
|
const { functionKey, method, stage } = params
|
|
173
171
|
|
|
174
172
|
return async (request, h) => {
|
|
175
|
-
this.#lastRequestOptions = {
|
|
176
|
-
headers: request.headers,
|
|
177
|
-
method: request.method,
|
|
178
|
-
payload: request.payload,
|
|
179
|
-
url: request.url.href,
|
|
180
|
-
}
|
|
181
|
-
|
|
182
173
|
const requestPath = this.#options.noPrependStageInUrl
|
|
183
174
|
? request.path
|
|
184
175
|
: request.path.substr(`/${stage}`.length)
|
|
@@ -322,7 +313,11 @@ export default class HttpServer {
|
|
|
322
313
|
})
|
|
323
314
|
|
|
324
315
|
const hapiMethod = method === 'ANY' ? '*' : method
|
|
325
|
-
const hapiOptions = {
|
|
316
|
+
const hapiOptions = {
|
|
317
|
+
response: {
|
|
318
|
+
emptyStatusCode: 200,
|
|
319
|
+
},
|
|
320
|
+
}
|
|
326
321
|
|
|
327
322
|
// skip HEAD routes as hapi will fail with 'Method name not allowed: HEAD ...'
|
|
328
323
|
// for more details, check https://github.com/dherault/serverless-offline/issues/204
|
|
@@ -1045,6 +1045,9 @@ export default class HttpServer {
|
|
|
1045
1045
|
const hapiOptions = {
|
|
1046
1046
|
auth: authStrategyName,
|
|
1047
1047
|
cors,
|
|
1048
|
+
response: {
|
|
1049
|
+
emptyStatusCode: 200,
|
|
1050
|
+
},
|
|
1048
1051
|
state,
|
|
1049
1052
|
timeout: {
|
|
1050
1053
|
socket: false,
|
|
@@ -1201,7 +1204,9 @@ export default class HttpServer {
|
|
|
1201
1204
|
}
|
|
1202
1205
|
|
|
1203
1206
|
if (hapiMethod !== 'GET' && hapiMethod !== 'HEAD') {
|
|
1204
|
-
hapiOptions.payload = {
|
|
1207
|
+
hapiOptions.payload = {
|
|
1208
|
+
parse: false,
|
|
1209
|
+
}
|
|
1205
1210
|
}
|
|
1206
1211
|
|
|
1207
1212
|
log.notice(`${method} ${hapiPath} -> ${proxyUriInUse}`)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import unflat from 'array-unflat-js'
|
|
2
2
|
|
|
3
3
|
const { fromEntries } = Object
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ export default function parseHeaders(rawHeaders) {
|
|
|
8
8
|
return null
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const unflattened =
|
|
11
|
+
const unflattened = unflat(rawHeaders)
|
|
12
12
|
|
|
13
13
|
return fromEntries(unflattened)
|
|
14
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import unflat from 'array-unflat-js'
|
|
2
2
|
|
|
3
3
|
const { fromEntries } = Object
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ export default function parseMultiValueHeaders(rawHeaders) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const map = new Map()
|
|
13
|
-
const unflattened =
|
|
13
|
+
const unflattened = unflat(rawHeaders)
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line no-restricted-syntax
|
|
16
16
|
for (const [key, value] of unflattened) {
|
package/src/utils/unflatten.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// [0, 1, 2, 3, 4 ,5] => [[0, 1], [2, 3], [4, 5]]
|
|
2
|
-
export default function unflatten(value, size) {
|
|
3
|
-
const unflattened = []
|
|
4
|
-
|
|
5
|
-
for (let i = 0; i < value.length; i += size) {
|
|
6
|
-
const slice = value.slice(i, i + size)
|
|
7
|
-
unflattened.push(slice)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return unflattened
|
|
11
|
-
}
|