Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter out custom content length header #180

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -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
},
Expand Down
4 changes: 4 additions & 0 deletions lib/routes/bins/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ 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)
Expand Down
4 changes: 4 additions & 0 deletions lib/routes/bins/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ 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)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/)",
Expand Down
Loading