Skip to content

fix: Add browser compatibility for Content-Length header restrictions #101

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

Closed
wants to merge 3 commits into from

Conversation

hussnainzafar
Copy link
Contributor

Closes #

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • CHANGELOG.md has been updated (for bug fixes / features / docs)

What kind of change does this PR introduce?

Bug fix

What was changed?

Modified how Content-Length headers are handled in browser environments:

Added browser detection in Bucket.update, Record.write, and Batch operations
Implemented a read-delete-write approach for label updates in browsers
Added request interceptor to handle Content-Length headers in browsers
Related issues

Related issues

(Add links to related issues)

Does this PR introduce a breaking change?

No, this PR maintains backward compatibility while adding browser support.

Other information:

This fix addresses browser security restrictions that prevent setting the Content-Length header directly, which was causing 422 errors when updating labels in browser environments

@hussnainzafar hussnainzafar requested a review from atimin April 23, 2025 10:55
Copy link
Member

@atimin atimin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hussnainzafar , sorry, this patch doesn't make any sense to me. Why not just stop sending the content-length header when it's 0?

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

Successfully merging this pull request may close these issues.

3 participants