Skip to content

Commit

Permalink
fix(headers): Ensure that Content-type is the bottom header
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Feb 29, 2024
1 parent ade59e0 commit c7cf97e
Show file tree
Hide file tree
Showing 3 changed files with 658 additions and 608 deletions.
9 changes: 9 additions & 0 deletions lib/mime-node/index.js
Expand Up @@ -497,6 +497,15 @@ class MimeNode {
if (!this.getHeader('MIME-Version')) {
this.setHeader('MIME-Version', '1.0');
}

// Ensure that Content-Type is the last header for the root node
for (let i = this._headers.length - 2; i >= 0; i--) {
let header = this._headers[i];
if (header.key === 'Content-Type') {
this._headers.splice(i, 1);
this._headers.push(header);
}
}
}

this._headers.forEach(header => {
Expand Down

0 comments on commit c7cf97e

Please sign in to comment.