GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(headers): silently skip empty header names instead of throwing by rkdfx · Pull Request #10875 · axios/axios

fix(headers): silently skip empty header names instead of throwing #10875

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.

Sign up for GitHub

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

Merged
jasonsaayman merged 4 commits into axios:v1.x from rkdfx:fix/6959-empty-header-name-skip
May 22, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(headers): silently skip empty header names instead of throwing #10875

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
ee8713d
fix(headers): silently skip empty header names instead of throwing
rkdfx May 10, 2026
17fadb0
chore: add suggested test headers length assert
rkdfx May 13, 2026
9ceeec4
Merge branch 'v1.x' into fix/6959-empty-header-name-skip
jasonsaayman May 22, 2026
a63294d
test(headers): cover whitespace-only header names
jasonsaayman May 22, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

1 change: 1 addition & 0 deletions 1 PRE_RELEASE_CHANGELOG.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

## Bug Fixes

- **AxiosHeaders:** Silently skip empty response header names emitted by some React Native Android responses instead of throwing. (**#6959**, **#10875**)
- **Request Data:** Preserve enumerable symbol keys when merging plain request data before `transformRequest`. (**#6392**)

## Release Documentation TODO
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/core/AxiosHeaders.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AxiosHeaders {
const lHeader = normalizeHeader(_header);

if (!lHeader) {
throw new Error('header name must be a non-empty string');
return;
Comment thread
rkdfx marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

}

const key = utils.findKey(self, lHeader);
Expand Down
23 changes: 23 additions & 0 deletions 23 tests/unit/axiosHeaders.test.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ describe('AxiosHeaders', () => {

assert.strictEqual(headers.get('x-name'), '请求Injected: true用户');
});

// Regression: https://github.com/axios/axios/issues/6959
it('should silently skip empty header names', () => {
const headers = new AxiosHeaders();

assert.doesNotThrow(() => headers.set('', 'a'));
assert.doesNotThrow(() => headers.set(' ', 'b'));
assert.doesNotThrow(() => headers.set({ '': 'c', ' ': 'd', foo: 'bar' }));
assert.doesNotThrow(() =>
headers.set(
new Map([
['', 'e'],
[' ', 'f'],
['x', 'y'],
])
)
);

assert.strictEqual(headers.has(''), false);
assert.strictEqual(headers.get('foo'), 'bar');
assert.strictEqual(headers.get('x'), 'y');
Comment thread
rkdfx marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

assert.strictEqual(Object.keys(headers).length, 2);
});
});

it('should support uppercase name mapping for names overlapped by class methods', () => {
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.