Skip to content

Commit

Permalink
http: unify header treatment
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 17, 2023
1 parent 60b2a8f commit 4e681ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/api-web-request-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ describe('webRequest module', () => {
res.setHeader('Location', 'http://' + req.rawHeaders[1]);
res.end();
} else if (req.url === '/contentDisposition') {
res.setHeader('content-disposition', [' attachment; filename=aa%E4%B8%ADaa.txt']);
res.writeHead(200, [
'content-disposition',
Buffer.from('attachment; filename=aa中aa.txt').toString('binary')
]);
const content = req.url;
res.end(content);
} else {
Expand Down Expand Up @@ -478,7 +481,8 @@ describe('webRequest module', () => {
callback({});
});
const { data, headers } = await ajax(defaultURL + 'contentDisposition');
expect(headers).to.to.have.property('content-disposition', 'attachment; filename=aa%E4%B8%ADaa.txt');
const disposition = Buffer.from('attachment; filename=aa中aa.txt').toString('binary');
expect(headers).to.to.have.property('content-disposition', disposition);
expect(data).to.equal('/contentDisposition');
});

Expand Down

0 comments on commit 4e681ae

Please sign in to comment.