@h4ad/serverless-adapter 2.0.0 → 2.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.
@@ -69,6 +69,7 @@ class ApiGatewayV2Adapter {
69
69
  */
70
70
  getResponse({ headers: responseHeaders, body, isBase64Encoded, statusCode, response, }) {
71
71
  const headers = (0, core_1.getFlattenedHeadersMap)(responseHeaders);
72
+ const multiValueHeaders = (0, core_1.getMultiValueHeadersMap)(responseHeaders);
72
73
  const transferEncodingHeader = headers['transfer-encoding'];
73
74
  const hasTransferEncodingChunked = transferEncodingHeader && transferEncodingHeader.includes('chunked');
74
75
  if (hasTransferEncodingChunked) {
@@ -77,16 +78,15 @@ class ApiGatewayV2Adapter {
77
78
  if (response === null || response === void 0 ? void 0 : response.chunkedEncoding) {
78
79
  throw new Error('chunked encoding in response is not supported by API Gateway V1');
79
80
  }
80
- const cookies = headers['set-cookie'];
81
- if (cookies) {
82
- headers.cookies = cookies;
81
+ const cookies = multiValueHeaders['set-cookie'];
82
+ if (headers)
83
83
  delete headers['set-cookie'];
84
- }
85
84
  return {
86
85
  statusCode,
87
86
  body,
88
87
  headers,
89
88
  isBase64Encoded,
89
+ cookies,
90
90
  };
91
91
  }
92
92
  /**
@@ -26,8 +26,6 @@ class ServerlessRequest extends http_1.IncomingMessage {
26
26
  this.body = body;
27
27
  this.url = url;
28
28
  this.ip = remoteAddress;
29
- // ref: https://github.com/nodejs/node/blob/master/lib/internal/streams/readable.js#L1278
30
- this._readableState.endEmitted = true;
31
29
  this._read = () => {
32
30
  this.push(body);
33
31
  this.push(null);
@@ -29,7 +29,7 @@ export declare class ServerlessAdapter<TApp, TEvent, TContext, TCallback, TRespo
29
29
  /**
30
30
  * Settings for whether the response should be treated as binary or not
31
31
  *
32
- * @default `contentEncodings` and `contentTypes` are set with {@link DEFAULT_BINARY_ENCODINGS} and {@link DEFAULT_BINARY_ENCODINGS}, respectively.
32
+ * @default `contentEncodings` and `contentTypes` are set with {@link DEFAULT_BINARY_ENCODINGS} and {@link DEFAULT_BINARY_CONTENT_TYPES}, respectively.
33
33
  */
34
34
  protected binarySettings: BinarySettings;
35
35
  /**
@@ -31,11 +31,11 @@ class ServerlessAdapter {
31
31
  /**
32
32
  * Settings for whether the response should be treated as binary or not
33
33
  *
34
- * @default `contentEncodings` and `contentTypes` are set with {@link DEFAULT_BINARY_ENCODINGS} and {@link DEFAULT_BINARY_ENCODINGS}, respectively.
34
+ * @default `contentEncodings` and `contentTypes` are set with {@link DEFAULT_BINARY_ENCODINGS} and {@link DEFAULT_BINARY_CONTENT_TYPES}, respectively.
35
35
  */
36
36
  this.binarySettings = {
37
37
  contentEncodings: core_1.DEFAULT_BINARY_ENCODINGS,
38
- contentTypes: core_1.DEFAULT_BINARY_ENCODINGS,
38
+ contentTypes: core_1.DEFAULT_BINARY_CONTENT_TYPES,
39
39
  };
40
40
  /**
41
41
  * Indicates whether the error stack should be included in the response or not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h4ad/serverless-adapter",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "description": "This library enables you to utilize any Cloud or Event Source to respond to web and API requests using your existing Node.js application framework.",
5
5
  "main": "./lib/index.js",
6
6
  "files": [