Skip to content

fix: allow unsetting Accept-Encoding - #1861

Closed
krzysdz wants to merge 1 commit into
forwardemail:masterfrom
krzysdz:allow-unsetting-accept-encoding
Closed

krzysdz wants to merge 1 commit into
forwardemail:masterfrom
krzysdz:allow-unsetting-accept-encoding

Conversation

@krzysdz

@krzysdz krzysdz commented Oct 7, 2026 •

Copy link
Copy Markdown

This PR is based on #1560, with the following changes:

Warning

The new tests run only on Node.js, because only the Node.js code sets the default Accept-Encoding. The tests do not prevent a regression like #1573, because .unset() tests can be found only in test/node/.

Closes #1860

Checklist

  • I have ensured my pull request is not behind the main or master branch of the original repository.
  • I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • I have written a commit message that passes commitlint linting.
  • I have ensured that my code changes pass linting tests.
    None of the lint warnings are from my code.
  • I have ensured that my code changes pass unit tests.
  • I have described my pull request and the reasons for code changes along with context if necessary.

Footnotes

  1. Except that request.post('/sth').send({ name: 'tj' }).unset('Content-Type').end() will fail, because the data cannot be serialised as serialisation function is chosen in ._end() based on the Content-Type. This probably should be another issue. ↩

@titanism titanism closed this in cc24a56 Nov 7, 2026
@titanism

titanism commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this, and for the original report in #1860. #1865 and #1867 took the same approach, and the combined commit credits this PR as the first. Compared with it, the commit creates the unset record only when unset() is called, keeps the header unset after redirects, and removes headers regardless of capitalization. Closing in favor of that commit, released in v10.4.2 and now available on npm: https://github.com/forwardemail/superagent/releases/tag/v10.4.2

Consider supporting our efforts to maintain this project by using Forward Email for your email infrastructure needs at https://forwardemail.net.

@krzysdz
krzysdz deleted the allow-unsetting-accept-encoding branch November 7, 2026 09:26
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.

[fix] Cannot unset Accept-Encoding

2 participants