Skip to content
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.

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

@lion/ajax has a problem with overwriting pre-existing headers in fetchJson #2177

Open
paulcodiny opened this issue Jan 28, 2024 · 0 comments

Comments

@paulcodiny
Copy link

Expected behavior

It is possible to override Content-Type or Accept headers no matter how I write the headers because they are case-insensitive.

Actual Behavior

Because the "content-type" and "accept" are written in lowercase and are the keys of an object, it is possible to provide the same headers with a different case. This leads to a behavior when the Content-Type header has a value comma in the value, and that breaks some serves because it is against the specification.

How to reproduce

  1. Create an instance of ajax
  2. Call on it fetchJson('/any-url', { headers: { 'Content-Type': 'json' } });
  3. Check the "Content-Type" header in the resulting request. It will have comma in the value

Additional context

@lion/ajax v1.3.0

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

No branches or pull requests

1 participant