From 2f458754afd22c7aa83e2b8e3011477b6e8f4446 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sun, 3 Sep 2023 22:37:55 +0300 Subject: [PATCH 01/21] w ip --- README.md | 2 ++ index.d.ts | 1 + index.js | 2 ++ lib/response.js | 30 +++++++++++++++++++----------- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 24a499b..af5df2e 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,8 @@ Require the `lambda-api` module into your Lambda handler script and instantiate | errorHeaderWhitelist | `Array` | Array of headers to maintain on errors | | s3Config | `Object` | Optional object to provide as config to S3 sdk. [S3ClientConfig](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html) | +| lowercaseHeaders | `Boolean` | Decide whether to lowercase all header names and values. This allows you to decide whether to compile with the [http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). + ```javascript // Require the framework and instantiate it with optional version and base parameters const api = require('lambda-api')({ version: 'v1.0', base: 'v1' }); diff --git a/index.d.ts b/index.d.ts index 0d7a523..37db351 100644 --- a/index.d.ts +++ b/index.d.ts @@ -134,6 +134,7 @@ export declare interface Options { compression?: boolean; headers?: object; s3Config?: S3ClientConfig; + lowercaseHeaders?: boolean; } export declare class Request { diff --git a/index.js b/index.js index cdd9b43..35af322 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,8 @@ const { ConfigurationError } = require('./lib/errors'); class API { constructor(props) { this._version = props && props.version ? props.version : 'v1'; + this._lowercaseHeaders = + props && props._lowercaseHeaders ? props._lowercaseHeaders : true; this._base = props && props.base && typeof props.base === 'string' ? props.base.trim() diff --git a/lib/response.js b/lib/response.js index 3b1bf04..3e20328 100644 --- a/lib/response.js +++ b/lib/response.js @@ -69,7 +69,7 @@ class RESPONSE { // Adds a header field header(key, value, append) { - let _key = key.toLowerCase(); // store as lowercase + let _key = this.app._lowercaseHeaders ? key.toLowerCase() : key; let _values = value ? (Array.isArray(value) ? value : [value]) : ['']; this._headers[_key] = append ? this.hasHeader(_key) @@ -81,18 +81,23 @@ class RESPONSE { // Gets a header field getHeader(key, asArr) { - if (!key) + let _key = this.app._lowercaseHeaders ? key.toLowerCase() : key || ''; + if (!_key) return asArr ? this._headers - : Object.keys(this._headers).reduce( - (headers, key) => - Object.assign(headers, { [key]: this._headers[key].toString() }), - {} - ); // return all headers + : Object.keys(this._headers).reduce((headers, childKkey) => { + let _childKey = this.app._lowercaseHeaders + ? childKkey.toLowerCase() + : childKkey; + Object.assign(headers, { + [_childKey]: this._headers[_childKey].toString(), + }); + }, {}); + return asArr ? this._headers[key.toLowerCase()] - : this._headers[key.toLowerCase()] - ? this._headers[key.toLowerCase()].toString() + : this._headers[_key] + ? this._headers[_key].toString() : undefined; } @@ -102,13 +107,16 @@ class RESPONSE { // Removes a header field removeHeader(key) { - delete this._headers[key.toLowerCase()]; + let _key = this.app._lowercaseHeaders ? key.toLowerCase() : key || ''; + delete this._headers[_key]; return this; } // Returns boolean if header exists hasHeader(key) { - return this.getHeader(key ? key : '') !== undefined; + let _key = + this.app._lowercaseHeaders && key ? key.toLowerCase() : key || ''; + return this.getHeader(_key || '') !== undefined; } // Convenience method for JSON From c6027f7d8eccfe3c495be9446973d4bc9b2d1ef5 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sun, 3 Sep 2023 22:40:51 +0300 Subject: [PATCH 02/21] . --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af5df2e..b1dc2dc 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Require the `lambda-api` module into your Lambda handler script and instantiate | errorHeaderWhitelist | `Array` | Array of headers to maintain on errors | | s3Config | `Object` | Optional object to provide as config to S3 sdk. [S3ClientConfig](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html) | -| lowercaseHeaders | `Boolean` | Decide whether to lowercase all header names and values. This allows you to decide whether to compile with the [http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). +| lowercaseHeaders | `Boolean` | Decide whether to lowercase all header names and values. This allows you to decide whether to compile with the [http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). ```javascript // Require the framework and instantiate it with optional version and base parameters From 34aaf7f3aff7782348df4b76a802ccfbbc5d290f Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sun, 3 Sep 2023 23:42:05 +0300 Subject: [PATCH 03/21] . --- index.d.ts | 2 +- lib/response.js | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/index.d.ts b/index.d.ts index 37db351..19cd1ff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -201,7 +201,7 @@ export declare class Response { header(key: string, value?: string | Array, append?: boolean): this; - getHeader(key: string): string; + getHeader(key: string, asArr?: boolean): string; hasHeader(key: string): boolean; diff --git a/lib/response.js b/lib/response.js index 3e20328..dfd4118 100644 --- a/lib/response.js +++ b/lib/response.js @@ -68,8 +68,8 @@ class RESPONSE { } // Adds a header field - header(key, value, append) { - let _key = this.app._lowercaseHeaders ? key.toLowerCase() : key; + header(key, value, append = false) { + let _key = this._normalizeHeaderKey(key); let _values = value ? (Array.isArray(value) ? value : [value]) : ['']; this._headers[_key] = append ? this.hasHeader(_key) @@ -81,21 +81,21 @@ class RESPONSE { // Gets a header field getHeader(key, asArr) { - let _key = this.app._lowercaseHeaders ? key.toLowerCase() : key || ''; + let _key = this._normalizeHeaderKey(key); if (!_key) return asArr ? this._headers : Object.keys(this._headers).reduce((headers, childKkey) => { - let _childKey = this.app._lowercaseHeaders - ? childKkey.toLowerCase() - : childKkey; - Object.assign(headers, { + let _childKey = this._normalizeHeaderKey(childKkey); + + return { + ...headers, [_childKey]: this._headers[_childKey].toString(), - }); + }; }, {}); return asArr - ? this._headers[key.toLowerCase()] + ? this._headers[_key] : this._headers[_key] ? this._headers[_key].toString() : undefined; @@ -107,18 +107,21 @@ class RESPONSE { // Removes a header field removeHeader(key) { - let _key = this.app._lowercaseHeaders ? key.toLowerCase() : key || ''; + let _key = this._normalizeHeaderKey(key); delete this._headers[_key]; return this; } // Returns boolean if header exists hasHeader(key) { - let _key = - this.app._lowercaseHeaders && key ? key.toLowerCase() : key || ''; + let _key = this._normalizeHeaderKey(key); return this.getHeader(_key || '') !== undefined; } + _normalizeHeaderKey(key = '') { + return this.app._lowercaseHeaders ? key.toLowerCase() : key; + } + // Convenience method for JSON json(body) { this.header('Content-Type', 'application/json').send( From 2335d9d33c930dd439ffb174edc7a2cf9e1cbd45 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sun, 3 Sep 2023 23:47:44 +0300 Subject: [PATCH 04/21] . --- lib/response.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/response.js b/lib/response.js index dfd4118..f53bc35 100644 --- a/lib/response.js +++ b/lib/response.js @@ -519,16 +519,20 @@ class RESPONSE { if ( this._etag && // if etag support enabled ['GET', 'HEAD'].includes(this._request.method) && - !this.hasHeader('etag') && + !this.hasHeader('ETag') && this._statusCode === 200 ) { - this.header('etag', '"' + UTILS.generateEtag(body) + '"'); + this.header('ETag', '"' + UTILS.generateEtag(body) + '"'); } + const etagHeaderKey = this._normalizeHeaderKey('ETag'); + const ifNoneMatchHeaderKey = this._normalizeHeaderKey('If-None-Match'); + // Check for matching Etag if ( - this._request.headers['if-none-match'] && - this._request.headers['if-none-match'] === this.getHeader('etag') + this._request.headers[ifNoneMatchHeaderKey] && + this._request.headers[ifNoneMatchHeaderKey] === + this.getHeader(etagHeaderKey) ) { this.status(304); body = ''; @@ -538,9 +542,11 @@ class RESPONSE { let cookies = {}; if (this._request.payloadVersion === '2.0') { - if (this._headers['set-cookie']) { - cookies = { cookies: this._headers['set-cookie'] }; - delete this._headers['set-cookie']; + const setCookieHeaderKey = this._normalizeHeaderKey('set-cookie'); + + if (this._headers[setCookieHeaderKey]) { + cookies = { cookies: this._headers[setCookieHeaderKey] }; + delete this._headers[setCookieHeaderKey]; } } @@ -584,12 +590,16 @@ class RESPONSE { body: data.toString('base64'), isBase64Encoded: true, }); + + const contentEncodingHeaderKey = + this._normalizeHeaderKey('content-encoding'); + if (this._response.multiValueHeaders) { - this._response.multiValueHeaders['content-encoding'] = [ + this._response.multiValueHeaders[contentEncodingHeaderKey] = [ contentEncoding, ]; } else { - this._response.headers['content-encoding'] = contentEncoding; + this._response.headers[contentEncodingHeaderKey] = contentEncoding; } } } From 36e7631eb728ee250acc6b5fa35f10f52ae7d90b Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:00:11 +0300 Subject: [PATCH 05/21] . --- README.md | 16 +++++++++++++++- index.d.ts | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b1dc2dc..3f0dfe6 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Require the `lambda-api` module into your Lambda handler script and instantiate | errorHeaderWhitelist | `Array` | Array of headers to maintain on errors | | s3Config | `Object` | Optional object to provide as config to S3 sdk. [S3ClientConfig](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html) | -| lowercaseHeaders | `Boolean` | Decide whether to lowercase all header names and values. This allows you to decide whether to compile with the [http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). +| lowercaseHeaderKeys | `Boolean` | Decide whether to lowercase all header names and values. This allows you to decide whether to compile with the [http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). ```javascript // Require the framework and instantiate it with optional version and base parameters @@ -165,6 +165,18 @@ const api = require('lambda-api')({ version: 'v1.0', base: 'v1' }); For detailed release notes see [Releases](https://github.com/jeremydaly/lambda-api/releases). +# v.1.0.3: allow to control header keys behavior + +In the past, by default, we normalized all headers to be lowercased based on [the http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). +This has caused issues for some of our consumers, therefore we're adding a new API option called `lowercaseHeaderKeys`. +By default it's set to true, in order to not break the already existing implementation. + +# v.1.0: move to AWS-SDK v3 + +Lambda API is now using AWS SDK v3. In case you're still using AWS SDK v2, please use a lambda-api version that is lower than 1.0. + + + ### v0.11: API Gateway v2 payload support and automatic compression Lambda API now supports API Gateway v2 payloads for use with HTTP APIs. The library automatically detects the payload, so no extra configuration is needed. Automatic [compression](#compression) has also been added and supports Brotli, Gzip and Deflate. @@ -658,6 +670,8 @@ api.get('/redirectToS3File', (req, res) => { Convenience method for adding [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) headers to responses. An optional `options` object can be passed in to customize the defaults. +NOTE: in order to allow CORS for all browsers, please set `lowercaseHeaderKeys` option to `false`. + The six defined **CORS** headers are as follows: - Access-Control-Allow-Origin (defaults to `*`) diff --git a/index.d.ts b/index.d.ts index 19cd1ff..c9014d0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -134,7 +134,7 @@ export declare interface Options { compression?: boolean; headers?: object; s3Config?: S3ClientConfig; - lowercaseHeaders?: boolean; + lowercaseHeaderKeys?: boolean; } export declare class Request { From 50dbb0cf23c4da286a7be7842f4db1f34d0f1d48 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:00:56 +0300 Subject: [PATCH 06/21] . --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f0dfe6..560ae45 100644 --- a/README.md +++ b/README.md @@ -670,7 +670,7 @@ api.get('/redirectToS3File', (req, res) => { Convenience method for adding [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) headers to responses. An optional `options` object can be passed in to customize the defaults. -NOTE: in order to allow CORS for all browsers, please set `lowercaseHeaderKeys` option to `false`. +NOTE: in order to allow CORS for all browsers when using http/1, please set `lowercaseHeaderKeys` option to `false`. The six defined **CORS** headers are as follows: From e90121b2798d4830dcaa27b3cb663a7412dd3c51 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:01:24 +0300 Subject: [PATCH 07/21] . --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 560ae45..d59c0cd 100644 --- a/README.md +++ b/README.md @@ -167,16 +167,14 @@ For detailed release notes see [Releases](https://github.com/jeremydaly/lambda-a # v.1.0.3: allow to control header keys behavior -In the past, by default, we normalized all headers to be lowercased based on [the http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). +In the past, by default, we normalized all headers to be lowercased based on [the http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). This has caused issues for some of our consumers, therefore we're adding a new API option called `lowercaseHeaderKeys`. -By default it's set to true, in order to not break the already existing implementation. +By default it's set to true, in order to not break the already existing implementation. # v.1.0: move to AWS-SDK v3 Lambda API is now using AWS SDK v3. In case you're still using AWS SDK v2, please use a lambda-api version that is lower than 1.0. - - ### v0.11: API Gateway v2 payload support and automatic compression Lambda API now supports API Gateway v2 payloads for use with HTTP APIs. The library automatically detects the payload, so no extra configuration is needed. Automatic [compression](#compression) has also been added and supports Brotli, Gzip and Deflate. @@ -670,7 +668,7 @@ api.get('/redirectToS3File', (req, res) => { Convenience method for adding [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) headers to responses. An optional `options` object can be passed in to customize the defaults. -NOTE: in order to allow CORS for all browsers when using http/1, please set `lowercaseHeaderKeys` option to `false`. +NOTE: in order to properly allow CORS for all browsers when using http/1, please set `lowercaseHeaderKeys` option to `false`. The six defined **CORS** headers are as follows: From ec13965cb4276d0c41597dab93f156171bb3403e Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:08:11 +0300 Subject: [PATCH 08/21] . --- .github/workflows/pull-request.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b762302..395feb9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: 'Pull Request' +name: "Pull Request" on: pull_request: types: [opened, reopened, synchronize] @@ -14,7 +14,7 @@ jobs: node: [14, 16, 18] name: Node ${{ matrix.node }} steps: - - name: 'Checkout latest code' + - name: "Checkout latest code" uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -22,11 +22,11 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - - name: Install latest npm - run: | - npm install -g npm@$NPM_VERSION && - npm --version && - npm list -g --depth 0 + # - name: Install latest npm + # run: | + # npm install -g npm@$NPM_VERSION && + # npm --version && + # npm list -g --depth 0 - name: Install dependencies run: npm ci - name: Install dependencies @@ -35,7 +35,7 @@ jobs: run: npm run test lint: - name: 'ESLint' + name: "ESLint" runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -45,14 +45,14 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint:check prettier: - name: 'Prettier' + name: "Prettier" runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -62,7 +62,7 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - name: Install dependencies run: npm ci - name: Run Prettier From 236a1d1474da6cc44adf5a8bf67637fef00666fd Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:10:38 +0300 Subject: [PATCH 09/21] . --- .github/workflows/pull-request.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 395feb9..918edae 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -22,13 +22,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - # - name: Install latest npm - # run: | - # npm install -g npm@$NPM_VERSION && - # npm --version && - # npm list -g --depth 0 - - name: Install dependencies - run: npm ci + cache: "npm" - name: Install dependencies run: npm ci - name: Run tests @@ -46,6 +40,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: "16" + cache: "npm" - name: Install dependencies run: npm ci - name: Run ESLint From 86f3f0c64ea4babc4bbbf79ad257956cb9dcb162 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:11:21 +0300 Subject: [PATCH 10/21] . --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 918edae..79c4647 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -24,7 +24,7 @@ jobs: node-version: ${{ matrix.node }} cache: "npm" - name: Install dependencies - run: npm ci + run: npm ci --legacy-peer-deps - name: Run tests run: npm run test From 9b6fe0ac22def352bf0b4aa41c3857aff75b8c8e Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:14:09 +0300 Subject: [PATCH 11/21] . --- .github/workflows/pull-request.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 79c4647..73901e5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -3,9 +3,6 @@ on: pull_request: types: [opened, reopened, synchronize] -env: - NPM_VERSION: latest - jobs: test: runs-on: ubuntu-latest @@ -23,8 +20,10 @@ jobs: with: node-version: ${{ matrix.node }} cache: "npm" + - name: Install latest NPM version + run: npm install -g npm@latest - name: Install dependencies - run: npm ci --legacy-peer-deps + run: npm ci - name: Run tests run: npm run test From 09a1519c6207107f7a5778732c4285bd7128de95 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:15:37 +0300 Subject: [PATCH 12/21] . --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 73901e5..eeaf9e3 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [14, 16, 18] + node: [14, 16.5.1, 18] name: Node ${{ matrix.node }} steps: - name: "Checkout latest code" From b8e0aeac619f88b1a4b67d158310c92c7fe45abe Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:15:42 +0300 Subject: [PATCH 13/21] . --- .github/workflows/pull-request.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index eeaf9e3..a466989 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: "Pull Request" +name: 'Pull Request' on: pull_request: types: [opened, reopened, synchronize] @@ -11,7 +11,7 @@ jobs: node: [14, 16.5.1, 18] name: Node ${{ matrix.node }} steps: - - name: "Checkout latest code" + - name: 'Checkout latest code' uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -19,7 +19,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - cache: "npm" + cache: 'npm' - name: Install latest NPM version run: npm install -g npm@latest - name: Install dependencies @@ -28,7 +28,7 @@ jobs: run: npm run test lint: - name: "ESLint" + name: 'ESLint' runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -38,15 +38,15 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: "16" - cache: "npm" + node-version: '16' + cache: 'npm' - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint:check prettier: - name: "Prettier" + name: 'Prettier' runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -56,7 +56,7 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: '16' - name: Install dependencies run: npm ci - name: Run Prettier From 39ffde7fbdefd713e6a7edbe42557f2629b63e6f Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:17:04 +0300 Subject: [PATCH 14/21] . --- .github/workflows/pull-request.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index a466989..327a311 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: 'Pull Request' +name: "Pull Request" on: pull_request: types: [opened, reopened, synchronize] @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [14, 16.5.1, 18] + node: [14, "16.5.1", 18] name: Node ${{ matrix.node }} steps: - - name: 'Checkout latest code' + - name: "Checkout latest code" uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -19,7 +19,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - cache: 'npm' + cache: "npm" - name: Install latest NPM version run: npm install -g npm@latest - name: Install dependencies @@ -28,7 +28,7 @@ jobs: run: npm run test lint: - name: 'ESLint' + name: "ESLint" runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -38,15 +38,15 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: '16' - cache: 'npm' + node-version: "16" + cache: "npm" - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint:check prettier: - name: 'Prettier' + name: "Prettier" runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -56,7 +56,7 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - name: Install dependencies run: npm ci - name: Run Prettier From ca621a9e958c7f7d50a72991e131bf6573ee3762 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:18:10 +0300 Subject: [PATCH 15/21] . --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 327a311..73901e5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [14, "16.5.1", 18] + node: [14, 16, 18] name: Node ${{ matrix.node }} steps: - name: "Checkout latest code" From 519403bda1fe370df8860621e137a9ee0ca92d48 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:20:41 +0300 Subject: [PATCH 16/21] . --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 73901e5..918e54f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -5,7 +5,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: node: [14, 16, 18] From d3e70b34a692086efee4e9ef9b7926ca532f5564 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:22:07 +0300 Subject: [PATCH 17/21] . --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 918e54f..0b6d734 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -5,7 +5,7 @@ on: jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: node: [14, 16, 18] @@ -21,7 +21,7 @@ jobs: node-version: ${{ matrix.node }} cache: "npm" - name: Install latest NPM version - run: npm install -g npm@latest + run: npm install -g npm@9 - name: Install dependencies run: npm ci - name: Run tests From cf61e267ecec3f5b9a78cca801ac8aaa339515a0 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:22:23 +0300 Subject: [PATCH 18/21] . --- .github/workflows/pull-request.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0b6d734..dfd01b6 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: "Pull Request" +name: 'Pull Request' on: pull_request: types: [opened, reopened, synchronize] @@ -11,7 +11,7 @@ jobs: node: [14, 16, 18] name: Node ${{ matrix.node }} steps: - - name: "Checkout latest code" + - name: 'Checkout latest code' uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -19,7 +19,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - cache: "npm" + cache: 'npm' - name: Install latest NPM version run: npm install -g npm@9 - name: Install dependencies @@ -28,7 +28,7 @@ jobs: run: npm run test lint: - name: "ESLint" + name: 'ESLint' runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -38,15 +38,15 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: "16" - cache: "npm" + node-version: '16' + cache: 'npm' - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint:check prettier: - name: "Prettier" + name: 'Prettier' runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -56,7 +56,7 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: '16' - name: Install dependencies run: npm ci - name: Run Prettier From 37b2bcdf59fad392570e2ea063655b2fa0b37b02 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:23:50 +0300 Subject: [PATCH 19/21] . --- .github/workflows/pull-request.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index dfd01b6..0b6d734 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: 'Pull Request' +name: "Pull Request" on: pull_request: types: [opened, reopened, synchronize] @@ -11,7 +11,7 @@ jobs: node: [14, 16, 18] name: Node ${{ matrix.node }} steps: - - name: 'Checkout latest code' + - name: "Checkout latest code" uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -19,7 +19,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - cache: 'npm' + cache: "npm" - name: Install latest NPM version run: npm install -g npm@9 - name: Install dependencies @@ -28,7 +28,7 @@ jobs: run: npm run test lint: - name: 'ESLint' + name: "ESLint" runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -38,15 +38,15 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: '16' - cache: 'npm' + node-version: "16" + cache: "npm" - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint:check prettier: - name: 'Prettier' + name: "Prettier" runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -56,7 +56,7 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - name: Install dependencies run: npm ci - name: Run Prettier From 2e71a5686820df0c8433a517cdd6d7b04494b6a1 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:48:32 +0300 Subject: [PATCH 20/21] . --- .github/workflows/pull-request.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0b6d734..0433b6b 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: "Pull Request" +name: 'Pull Request' on: pull_request: types: [opened, reopened, synchronize] @@ -11,7 +11,7 @@ jobs: node: [14, 16, 18] name: Node ${{ matrix.node }} steps: - - name: "Checkout latest code" + - name: 'Checkout latest code' uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -19,8 +19,8 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - cache: "npm" - - name: Install latest NPM version + cache: 'npm' + - name: Install NPM run: npm install -g npm@9 - name: Install dependencies run: npm ci @@ -28,7 +28,7 @@ jobs: run: npm run test lint: - name: "ESLint" + name: 'ESLint' runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -38,15 +38,15 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: "16" - cache: "npm" + node-version: '16' + cache: 'npm' - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint:check prettier: - name: "Prettier" + name: 'Prettier' runs-on: ubuntu-latest steps: - name: Checkout latest code @@ -56,7 +56,7 @@ jobs: - name: Set up node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: '16' - name: Install dependencies run: npm ci - name: Run Prettier From f38ee1b573f5caf272c2deab77fa30e306665bb2 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Mon, 4 Sep 2023 00:50:14 +0300 Subject: [PATCH 21/21] oops --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 930ff1b..4bd869d 100644 --- a/README.md +++ b/README.md @@ -165,13 +165,13 @@ const api = require('lambda-api')({ version: 'v1.0', base: 'v1' }); For detailed release notes see [Releases](https://github.com/jeremydaly/lambda-api/releases). -# v.1.0.3: allow to control header keys behavior +# v1.0.3: allow to control header keys behavior In the past, by default, we normalized all headers to be lowercased based on [the http/2 spec](https://www.rfc-editor.org/rfc/rfc9113#name-http-fields). This has caused issues for some of our consumers, therefore we're adding a new API option called `lowercaseHeaderKeys`. By default it's set to true, in order to not break the already existing implementation. -# v.1.0: move to AWS-SDK v3 +# v1.0: move to AWS-SDK v3 Lambda API is now using AWS SDK v3. In case you're still using AWS SDK v2, please use a lambda-api version that is lower than 1.0.