Commit 5dafcbd
committed
fix(utils): correct Content-Length for io.StringIO bodies (#6917)
- Add special handling for io.StringIO in super_len() function
- Calculate byte length by encoding StringIO content as UTF-8
- Preserve stream position to avoid surprising users
- Fixes incorrect Content-Length header when StringIO contains multi-byte UTF-8 characters1 parent da9113c commit 5dafcbd
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
143 | 161 | | |
144 | 162 | | |
145 | 163 | | |
| |||
0 commit comments