-
Notifications
You must be signed in to change notification settings - Fork 34
Clear Headers After File Upload to Prevent Request Issues #33
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
base: dev
Are you sure you want to change the base?
Conversation
This is a critical issue and this PR needs to be resolved ASAP |
As a workaround for now you can use reflect
|
Hello I check this issue asap! Thanks for contributions 🎊 |
@darwishdev I checked your fork but it still has another issue if you have two upload requests at the same time you will get "fatal error: concurrent map writes" error because of both requests try to access the same header at the same time. Please use sync.Mutex in order to fix that. I return back to my workaround until you solve it :)
|
It seems like the above solution still does not prevent the issue and it has to be solved from the library itself because I use fileOptions |
This PR fixes a bug where headers set during file uploads (such as
cache-control
,content-type
, andx-upsert
) persist after the request, causing errors in subsequent API calls. Specifically, after a successful upload with options likeupsert: true
, the headers remain unchanged, leading to issues when using the storage client for other operations (e.g., listing files).Reproduction Steps:
UploadOrUpdateFile
function with options like{ Upsert: true }
:storage_client
, the storage client starts working again, indicating that headers were not properly cleared after the upload request.Fix:
defer
, preventing them from affecting future requests.Issue Resolved:
"body must be object"
error when listing files after an upload with options.