Commit 0824dfb
committed
fix: address round-5 review comments on 401 edge cases
Three fixes from claude[bot] review:
1. _startOrAuthSse 405 return doesn't reset _authRetryInFlight —
401 → onUnauthorized → retry → 405 would leave the flag set
forever, disabling onUnauthorized for subsequent send() 401s.
Added reset before the 405 return.
2. SSE onerror handler — when onUnauthorized rejects in the connect
path, the error went through .then(resolve, reject) without
calling this.onerror. Every other error path in both transports
calls both. Added this.onerror?.() before reject.
3. 401 with no authProvider drained body twice — the 401 block
ran unconditionally, drained at line 232/285/521, fell through
(no authProvider = no throw), then the generic error handler
drained again (empty) and produced 'HTTP 401: null'. Gated the
entire 401 block on this._authProvider (matching pre-PR
structure) so no-auth 401s hit the generic error directly with
intact body text.1 parent 3aa0cd6 commit 0824dfb
2 files changed
Lines changed: 14 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
| |||
261 | 264 | | |
262 | 265 | | |
263 | 266 | | |
264 | | - | |
| 267 | + | |
265 | 268 | | |
266 | 269 | | |
267 | 270 | | |
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
271 | | - | |
| 274 | + | |
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| |||
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
288 | | - | |
289 | | - | |
290 | | - | |
| 291 | + | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
240 | | - | |
| 238 | + | |
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
244 | 242 | | |
245 | 243 | | |
246 | 244 | | |
247 | 245 | | |
| 246 | + | |
248 | 247 | | |
249 | 248 | | |
250 | 249 | | |
| |||
500 | 499 | | |
501 | 500 | | |
502 | 501 | | |
503 | | - | |
| 502 | + | |
504 | 503 | | |
505 | 504 | | |
506 | 505 | | |
507 | 506 | | |
508 | 507 | | |
509 | 508 | | |
510 | 509 | | |
511 | | - | |
| 510 | + | |
512 | 511 | | |
513 | 512 | | |
514 | 513 | | |
| |||
525 | 524 | | |
526 | 525 | | |
527 | 526 | | |
528 | | - | |
529 | | - | |
530 | | - | |
| 527 | + | |
531 | 528 | | |
532 | 529 | | |
533 | 530 | | |
| |||
0 commit comments