Skip to content

Commit 4e681ae

Browse files
committed
http: unify header treatment
nodejs/node#46528
1 parent 60b2a8f commit 4e681ae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spec/api-web-request-spec.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ describe('webRequest module', () => {
2222
res.setHeader('Location', 'http://' + req.rawHeaders[1]);
2323
res.end();
2424
} else if (req.url === '/contentDisposition') {
25-
res.setHeader('content-disposition', [' attachment; filename=aa%E4%B8%ADaa.txt']);
25+
res.writeHead(200, [
26+
'content-disposition',
27+
Buffer.from('attachment; filename=aa中aa.txt').toString('binary')
28+
]);
2629
const content = req.url;
2730
res.end(content);
2831
} else {
@@ -478,7 +481,8 @@ describe('webRequest module', () => {
478481
callback({});
479482
});
480483
const { data, headers } = await ajax(defaultURL + 'contentDisposition');
481-
expect(headers).to.to.have.property('content-disposition', 'attachment; filename=aa%E4%B8%ADaa.txt');
484+
const disposition = Buffer.from('attachment; filename=aa中aa.txt').toString('binary');
485+
expect(headers).to.to.have.property('content-disposition', disposition);
482486
expect(data).to.equal('/contentDisposition');
483487
});
484488

0 commit comments

Comments
 (0)