Commit 99d9136
fix(storage): avoid duplicate Content-Type headers and header mutation (#1359)
* fix(storage): avoid duplicate Content-Type headers and header mutation
In _handleRequest, the headers map was being mutated directly by adding
Content-Type: application/json. This meant:
1. The stored headers map on StorageFileApi/_StorageBucketApi was permanently
mutated after each non-GET request, accumulating Content-Type.
2. Custom Content-Type headers set via setHeader() were overwritten
unconditionally, ignoring caller intent.
Fix: copy headers before modifying, and use a case-insensitive check
for an existing Content-Type before setting the application/json default.
Linear: SDK-881
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* style(storage): format fetch.dart
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update packages/storage_client/lib/src/fetch.dart
Co-authored-by: Vinzent <vinzent03@proton.me>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Vinzent <vinzent03@proton.me>1 parent 9d0de9e commit 99d9136
2 files changed
Lines changed: 60 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
611 | 665 | | |
0 commit comments