googleapis / gcs-resumable-upload

This repository has been deprecated. Support will end on November 1, 2023. Upload a file to Google Cloud Storage with built-in resumable behavior
MIT License
62 stars 33 forks source link

fix: Stop Duplicate Response Handlers on Retries #502

Closed danielbankhead closed 2 years ago

danielbankhead commented 2 years ago

Previously, startUploading would setup a 'response' event listener for passing responses to responseHandler - this is problematic in the event of a retry as the retry would create its own request (thus previous requests would trigger responseHandler as well).

Instead, we can accomplish the desired functionality by checking makeRequestStream's return value.

Fixes #493 🦕