From bff2b48d37445bf3e45fc38a254575dcb3b87830 Mon Sep 17 00:00:00 2001 From: jackkav Date: Mon, 26 Aug 2024 15:07:32 +0200 Subject: [PATCH 1/3] filter out custom content length header --- lib/routes/bins/create.js | 2 ++ lib/routes/bins/update.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/routes/bins/create.js b/lib/routes/bins/create.js index 842af802..44492aa2 100644 --- a/lib/routes/bins/create.js +++ b/lib/routes/bins/create.js @@ -40,6 +40,8 @@ module.exports = (client) => (req, res, next) => { } mock.content.size = 0; + // express is sensitive to mismatched content-length header + mock.headers = mock.headers.filter((header) => header.name.toLowerCase() !== "content-length"); validate .response(mock) diff --git a/lib/routes/bins/update.js b/lib/routes/bins/update.js index 6aea1f59..43cf198f 100644 --- a/lib/routes/bins/update.js +++ b/lib/routes/bins/update.js @@ -37,6 +37,8 @@ module.exports = (client) => (req, res, next) => { } mock.content.size = 0; + // express is sensitive to mismatched content-length header + mock.headers = mock.headers.filter((header) => header.name.toLowerCase() !== "content-length"); validate .response(mock) From e050fe67b0fc3f7f3a29fffaea7eaddfe863b073 Mon Sep 17 00:00:00 2001 From: jackkav Date: Mon, 26 Aug 2024 15:34:40 +0200 Subject: [PATCH 2/3] fix formatting --- .vscode/settings.json | 4 +++- biome.json | 2 +- lib/routes/bins/create.js | 4 +++- lib/routes/bins/update.js | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1a477ca8..e32c9036 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,7 @@ { - "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "quickfix.biome": "explicit" + }, "[javascript]": { "editor.defaultFormatter": "biomejs.biome" }, diff --git a/biome.json b/biome.json index 8973bdcb..c91f1a4e 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.4.1/schema.json", + "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", "organizeImports": { "enabled": true }, diff --git a/lib/routes/bins/create.js b/lib/routes/bins/create.js index 44492aa2..72e0a0c9 100644 --- a/lib/routes/bins/create.js +++ b/lib/routes/bins/create.js @@ -41,7 +41,9 @@ module.exports = (client) => (req, res, next) => { mock.content.size = 0; // express is sensitive to mismatched content-length header - mock.headers = mock.headers.filter((header) => header.name.toLowerCase() !== "content-length"); + mock.headers = mock.headers.filter( + (header) => header.name.toLowerCase() !== "content-length", + ); validate .response(mock) diff --git a/lib/routes/bins/update.js b/lib/routes/bins/update.js index 43cf198f..4c428273 100644 --- a/lib/routes/bins/update.js +++ b/lib/routes/bins/update.js @@ -38,7 +38,9 @@ module.exports = (client) => (req, res, next) => { mock.content.size = 0; // express is sensitive to mismatched content-length header - mock.headers = mock.headers.filter((header) => header.name.toLowerCase() !== "content-length"); + mock.headers = mock.headers.filter( + (header) => header.name.toLowerCase() !== "content-length", + ); validate .response(mock) From 24f473f51cb6a3c7e7644970befc6bf37fd5ea81 Mon Sep 17 00:00:00 2001 From: jackkav Date: Mon, 26 Aug 2024 15:37:44 +0200 Subject: [PATCH 3/3] bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4cfa537f..1773f42b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mockbin", - "version": "2.0.2", + "version": "2.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mockbin", - "version": "2.0.2", + "version": "2.0.3", "license": "MIT", "dependencies": { "@idio/dicer": "1.1.0", diff --git a/package.json b/package.json index 71e41ba2..393d5d1f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "2.0.2", + "version": "2.0.3", "name": "mockbin", "description": "Test, mock, and track HTTP requests & responses between libraries, sockets and APIs", "author": "Kong (https://www.konghq.com/)",