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

Conversation

mikicho
Copy link
Contributor

@mikicho mikicho commented Sep 30, 2024

Following this: #598 (comment)

@@ -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' ] }

@kettanaito kettanaito changed the title Update package.json feat: update the node.js version range Oct 7, 2024
@mikicho mikicho requested a review from kettanaito October 7, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants