Skip to content

Conversation

@mikicho
Copy link
Member

@mikicho mikicho commented Sep 30, 2024

Following this: #598 (comment)

"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
Member 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
Member 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
@mikicho
Copy link
Member Author

mikicho commented Apr 19, 2025

@kettanaito I'm closing this. I updated the version in nock instead. It may be related to the rawHeaders feature, which we will probably remove soon anyway 🎉

@mikicho mikicho closed this Apr 19, 2025
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.

3 participants