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

feat: update the node.js version range #648

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 5 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: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"author": "Artem Zakharchenko",
"license": "MIT",
"engines": {
"node": ">=18"
"node": ">=18.20.0 <20 || >=20.12.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why skipping v21?

Also, could you give more context why we need to update the version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the rawHeaders symbol change in Node.js.

Why skipping v21?

What do you mean?
This range translates to: "any version between 18.20.0 and 20, OR anything above 20.12.1"
You can play this it here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still a bit confused. We currently don't depend on Node.js for raw headers and use our own proxy to gather them. Does the version change still apply in that case?

Copy link
Contributor Author

@mikicho mikicho Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting..

const { ClientRequestInterceptor } = require('@mswjs/interceptors/ClientRequest')
const http = require('http')

const interceptor = new ClientRequestInterceptor({
  name: 'my-interceptor',
})
interceptor.apply();
interceptor.on('request', async ({ controller }) => {
  controller.respondWith(new Response(null, { headers: { 'set-cookie':  ['mocked-cookie-0;mocked-cookie-1', 'mocked-cookie-2'] }}))
});

(async function () {
   http.get('http://example.com', (res) => {
    console.log(res.headers);
   });
})()

With version 20.11.1 the output is: (Array length is 1)

{ 'set-cookie': [ 'mocked-cookie-0;mocked-cookie-1,mocked-cookie-2' ] }

With version 20.12.2 the output is: (Array length is 2, as expected)

{ 'set-cookie': [ 'mocked-cookie-0;mocked-cookie-1', 'mocked-cookie-2' ] }

},
"scripts": {
"start": "tsc --build -w",
Expand Down Expand Up @@ -200,4 +200,4 @@
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}
Loading