Commit 2b006af
Add integration test for body duplication prevention
Addresses test coverage gap identified in code review. The new test:
1. Simulates a mid-stream connection error after partial chunks are sent
2. Verifies that StreamRequest properly retries with a fresh request
3. Confirms no duplicate chunks are yielded to the client
Test scenario:
- First attempt: sends "Chunk 1" then raises HTTPX::HTTPError
- Second attempt: successfully sends all 3 chunks
- Expected result: client receives exactly ["Chunk 1", "Chunk 2", "Chunk 3"]
- If HTTPx retries were enabled: would receive 4 chunks (duplication!)
This integration test validates the complete fix for #1895 by ensuring
that the combination of connection_without_retries and StreamRequest's
retry logic prevents body duplication.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent bae4005 commit 2b006af
1 file changed
+51
-3
lines changedLines changed: 51 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | 207 | | |
211 | 208 | | |
212 | 209 | | |
| |||
224 | 221 | | |
225 | 222 | | |
226 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
227 | 275 | | |
228 | 276 | | |
0 commit comments