Commit 9350ddf
authored
Do not treat Content-Length=0 as empty when Transfer-Encoding is chunked (#2572)
* fix(response): handle zero Content-Length correctly for chunked and non-chunked responses
Some HTTP servers incorrectly send `Content-Length: 0` together with
`Transfer-Encoding: chunked`. According to RFC 7230, chunked transfer
encoding overrides Content-Length and the body may still contain data.
Previously, the client treated any response with Content-Length=0 as
having an empty body, which caused valid chunked responses to be
discarded.
This change only treats Content-Length=0 as empty when the response is
not chunked, preserving correct behavior for misconfigured servers.
* chore: fix linting errors
* chore: revert accidental line changes
* chore: added changeset
* Resolve merge conflicts
* Properly check if content length is zero1 parent a690e52 commit 9350ddf
File tree
3 files changed
+42
-1
lines changed- .changeset
- packages/openapi-fetch
- src
- test/common
3 files changed
+42
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
241 | 245 | | |
242 | 246 | | |
243 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
207 | 239 | | |
0 commit comments