nise
nise copied to clipboard
Error when setting unsafe headers
We have code that works in live mode using xhr, but fails using mock.
https://github.com/sinonjs/nise/blob/805200b70084b1c19569ad0c04158da7bf5eed0c/lib/fake-xhr/index.js#L590
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.
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
?
@mroderick The spec for XHR says pretty much the same thing.
-
If this’s state is not opened, then throw an "
InvalidStateError
"DOMException
. -
If this’s
send()
flag is set, then throw an "InvalidStateError
"DOMException
. -
Normalize value.
-
If name is not a name or value is not a value, then throw a "
SyntaxError
"DOMException
. -
If name is a forbidden header name, then return.
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.