You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In sinon@5.0.7, using jQuery's $.ajax() to fetch a non-existent URL from fakeServer returns a 404 Not Found response, as expected.
In sinon@5.0.8 and later, the same fetch now returns a 0 status.
To Reproduce
npm install sinon@5.0.7, and run the tests below
npm install sinon@5.0.8, and re-run the tests again
describe.only("404 Not Found",()=>{letfakeServer;beforeEach(()=>(fakeServer=sinon.fakeServer.create({respondImmediately: true})));it("should work without headers",done=>{$.ajax({url: "/bad",headers: {},error(response){response.status.should.equal(404);response.statusText.should.equal("Not Found");done();}});});it("should work with headers",done=>{$.ajax({url: "/bad",headers: {"X-FOO": 1},error(response){response.status.should.equal(404);response.statusText.should.equal("Not Found");done();}});});afterEach(()=>fakeServer.restore());});
Expected 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 a 404 Not Found
In sinon@5.0.7, both specs pass.
In sinon@5.0.8 and later, the spec with the X-FOO request header fails
Screenshots
Results from sinon@5.0.7:
Results from sinon@5.0.8:
Context (please complete the following information):
Library version: 5.0.8+
Environment:
Example URL:
Other libraries you are using: jquery@3.3.1, webpack@4.10.2, chai@4.1.2, mocha@5.2.0
The text was updated successfully, but these errors were encountered:
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
![5_0_7](https://user-images.githubusercontent.com/289327/40766890-4dbbd024-64f4-11e8-90f0-2722dc524931.png)
Results from
sinon@5.0.7
:Results from
![5_0_8](https://user-images.githubusercontent.com/289327/40766957-78985a2e-64f4-11e8-8138-69b5b122b682.png)
sinon@5.0.8
:Context (please complete the following information):
The text was updated successfully, but these errors were encountered: