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

Fake server responds multiple times to single request, throws INVALID_STATE_ERR on subsequent requests #1528

Closed
n1ywb opened this issue Aug 11, 2017 · 5 comments
Labels

Comments

@n1ywb
Copy link

n1ywb commented Aug 11, 2017

We understand you have a problem and are in a hurry, but please provide us with some info to make it much more likely for your issue to be understood, worked on and resolved quickly.

What did you expect to happen?

when I set up two responders with server.respondWith only the first matching one should fire for any given request

What actually happens

first the wrong default one is handled for the given URL, then the correct one is handled which throws an uncaught INVALID_STATE_ERR exception

How to reproduce

https://codepen.io/anon/pen/eEEJVy?editors=0012

Really long code sample or stacktrace

start
15:03:37.183 VM4447 console_runner-079c09a….js:1 requesting foo
15:03:37.185 VM4447 console_runner-079c09a….js:1 default requested
15:03:37.187 VM4447 console_runner-079c09a….js:1 FakeXMLHttpRequest {eventListeners: Object, readyState: 1, requestHeaders: Object, requestBody: null, status: 0…}
15:03:37.191 VM4447 console_runner-079c09a….js:1 foo requested
15:03:37.193 VM4447 console_runner-079c09a….js:1 FakeXMLHttpRequest {eventListeners: Object, readyState: 4, requestHeaders: Object, requestBody: null, status: 404…}
15:03:37.194 VM4451 sinon.js:6427 Uncaught Object {name: "Error", message: "Fake server request processing threw exception: INVALID_STATE_ERR - 4", stack: "Error: INVALID_STATE_ERR - 4↵ at verifyRequestO…/sinon@3/pkg/sinon.js:7406:18)↵ at pen.js:42:5"}
throwLoggedError @ VM4451 sinon.js:6427
logError @ VM4451 sinon.js:6437
processRequest @ VM4451 sinon.js:6894
handleRequest @ VM4451 sinon.js:6812
xhrObj.onSend @ VM4451 sinon.js:6784
send @ VM4451 sinon.js:7406
(anonymous) @ VM4452 pen.js:35
(anonymous) @ VM4452 pen.js:37

@fatso83
Copy link
Contributor

fatso83 commented Aug 12, 2017

Moved to sinonjs/nise#8

@fatso83
Copy link
Contributor

fatso83 commented Aug 12, 2017

@mroderick Are we supposed to move and close these issues that relate to libraries that we depend on?

@mroderick
Copy link
Member

@mroderick Are we supposed to move and close these issues that relate to libraries that we depend on?

I think that is a great strategy

@mroderick
Copy link
Member

Or, at least do most of the work in the dependency repo, and just confirm the resolution here

@stale
Copy link

stale bot commented Jan 13, 2018

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 Jan 13, 2018
@stale stale bot closed this as completed Jan 20, 2018
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