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

Error when setting unsafe headers #177

Open
jeremymeng opened this issue Feb 25, 2021 · 3 comments
Open

Error when setting unsafe headers #177

jeremymeng opened this issue Feb 25, 2021 · 3 comments
Labels

Comments

@jeremymeng
Copy link

We have code that works in live mode using xhr, but fails using mock.

'Refused to set unsafe header "' + header + '"'

according to the spec, setting/deleting a forbidden header should be a no-op

Otherwise, if this’s guard is "request" and name is a forbidden header name, return.

image

@mroderick
Copy link
Member

according to the spec, setting/deleting a forbidden header should be a no-op

That's the spec for fetch. This library does not deal with fetch.

What is expected to happend for XHR?

@fatso83
Copy link
Contributor

fatso83 commented Feb 26, 2021

@mroderick The spec for XHR says pretty much the same thing.

  1. If this’s state is not opened, then throw an "InvalidStateError" DOMException.

  2. If this’s send() flag is set, then throw an "InvalidStateError" DOMException.

  3. Normalize value.

  4. If name is not a name or value is not a value, then throw a "SyntaxError" DOMException.

    An empty byte sequence represents an empty header value.

  5. If name is a forbidden header name, then return.

  6. Combine name/value in this’s author request headers.

Copy link

stale bot commented Dec 27, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants