-
Notifications
You must be signed in to change notification settings - Fork 45
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
Regression when $.ajax() XHR includes headers #51
Comments
Probably happened in 082f8e8ab3f8b5d6332550dd05c5b3c6fed82d91, going from |
@scottohara, if you get a chance to do a git bisect to track down which commit introduced this in |
Thanks @fatso83.
This is the only change between v1.3.2 and v1.3.3. Further analysis shows that the error only occurs if the value of the header being set is numeric It looks like there's already a PR with a fix for this very issue (#48); so presumably all that needs to happen is to merge that PR and cut a new v1.3.4 release? |
Great find! Sometimes PRs slip throug the cracks :-) Thank you! |
I closed #48 because it's incorrect to supply a non-string value when setting a header value. That means supplying |
So, it's not the case that supplying headers is wrong, it's supplying invalid values that fails. In that respect, this isn't a bug, but we should aim to improve the feedback. |
According to RFC7230, http fields have used to be text and new headers should continue to do so, restricting the values to consist of US-ASCII octets. This test is not so strict, but we avoid a whole range of errors by just checking if the value is a string. Ref sinonjs#51 and sinonjs#48
See PR #53 |
According to RFC7230, http fields have used to be text and new headers should continue to do so, restricting the values to consist of US-ASCII octets. This test is not so strict, but we avoid a whole range of errors by just checking if the value is a string. Ref sinonjs#51, sinonjs#48 and https://tools.ietf.org/html/rfc7230#section-3.2.4
According to RFC7230, http fields have used to be text and new headers should continue to do so, restricting the values to consist of US-ASCII octets. This test is not so strict, but we avoid a whole range of errors by just checking if the value is a string. Ref #51, #48 and https://tools.ietf.org/html/rfc7230#section-3.2.4
From @scottohara on May 31, 2018 7:10
Describe the bug
In
sinon@5.0.7
, using jQuery's$.ajax()
to fetch a non-existent URL fromfakeServer
returns a404 Not Found
response, as expected.In
sinon@5.0.8
and later, the same fetch now returns a0
status.To Reproduce
npm install sinon@5.0.7
, and run the tests belownpm install sinon@5.0.8
, and re-run the tests againExpected behavior
The specs above create a
fakeServer
and then attempt to fetch a non-existant URL (/bad
).The only difference between the two specs is the second includes a request header,
X-FOO: 1
.The specs assert the response returned from
fakeServer
is a404 Not Found
In
sinon@5.0.7
, both specs pass.In
sinon@5.0.8
and later, the spec with theX-FOO
request header failsScreenshots
Results from
sinon@5.0.7
:Results from
sinon@5.0.8
:Context (please complete the following information):
Copied from original issue: sinonjs/sinon#1817
The text was updated successfully, but these errors were encountered: