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

Fakeserver should support triggering progress events #1584

Closed
tarjei opened this issue Oct 9, 2017 · 4 comments
Closed

Fakeserver should support triggering progress events #1584

tarjei opened this issue Oct 9, 2017 · 4 comments

Comments

@tarjei
Copy link
Contributor

tarjei commented Oct 9, 2017

Hi, AFAIK there is no way to get the fake server to trigger progress events during an upload.

It would be very useful this was possible in a simple way. Maybe:

    server = sinon.fakeServer.create()
    server.responWith((r) => {...})
// this fires for all requests - not ideal but very accessable and would solve 80% of all usecases
    server.updateProgress({lengthComputable: true, loaded: 100, total: 200 })
  • Sinon version : 4.0
  • Other libraries you are using: Mocha, Karma

**What did you expect to happen?

I would expect the progress event to fire for all requests.

@fatso83
Copy link
Contributor

fatso83 commented Oct 9, 2017

Are you sure about this? We have support for ProgressEvent, and a quick grep of nise shows:

2375:        it("progress event is triggered with xhr.uploadProgress({loaded, 20, total, 100})", function (done) {
2376:            this.xhr.upload.addEventListener("progress", function (e) {

@tarjei
Copy link
Contributor Author

tarjei commented Oct 9, 2017

@fatso83 hmm, the test you are referring triggers on the xhr interface - not the server interface :)

@fatso83
Copy link
Contributor

fatso83 commented Oct 9, 2017

OK, I see, you basically want a utility wrapper that aggregates the events. Could you close this and open a feature request on the sinonjs/nise project? Or a PR ;-)

@tarjei
Copy link
Contributor Author

tarjei commented Oct 9, 2017

Will do. I'll also try to come up with a PR for the docs on using server.requests to trigger progress events :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants