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
dont serialize null as header values #250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got me as I use undefined
in my header tests, thanks for the fix!
Technically this does not match node core behavior. It serializes |
Ah balls, what about |
const { createServer, request } = require('http');
const server = createServer((req, res) => {
res.setHeader('Content-Type', 'text/plain');
try {
res.setHeader('X-undefined', undefined);
} catch (err) {
console.log('undefined could not be set')
}
res.setHeader('X-null', null);
res.end('Hello World!');
})
server.listen(3000, function () {
console.log('Server listening on port 3000');
request('http://localhost:3000', function (res) {
console.log(res.headers);
process.exit(0);
}).end()
}); |
Aight, cool. I was using const sitewideExpectedHeaders = {
'Content-Type': 'application/json',
expires: "0",
}
const cacheablepageExpectedHeaders = {
...sitewideExpectedHeaders,
expires: undefined
} Guess I'll need to just change it to use |
fixes #249
Checklist
npm run test
andnpm run benchmark
and the Code of conduct