Commit 09b4a9b
committed
Allow duplicate class to AddHttpClient<T>
Fixes: dotnet/extensions#2077
In 3.0 we introduced validation to try and prevent some cases of invalid
usage on the factory that had lead to user bug reports.
Unfortunately we blocked a few legitimate usage scenarios behind
expections.
In this case the common usage is for a library to register a typed
client with `AddHttpClient<MyClient>(...)`. User code can then
collaborate by calling the same thing, and interacting with the builder
that's returned.
This change explicitly allows this pattern by fine-tuning the
validation.
Commit migrated from dotnet/extensions@b2165d71 parent 9e81e13 commit 09b4a9b
2 files changed
Lines changed: 57 additions & 4 deletions
File tree
- src/libraries/Microsoft.Extensions.Http
- src/DependencyInjection
- tests/DependencyInjection
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
536 | 541 | | |
537 | 542 | | |
538 | 543 | | |
| |||
542 | 547 | | |
543 | 548 | | |
544 | 549 | | |
545 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
546 | 554 | | |
547 | 555 | | |
548 | 556 | | |
| |||
Lines changed: 47 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
351 | 396 | | |
352 | 397 | | |
353 | 398 | | |
| |||
365 | 410 | | |
366 | 411 | | |
367 | 412 | | |
368 | | - | |
| 413 | + | |
369 | 414 | | |
370 | 415 | | |
371 | 416 | | |
| |||
0 commit comments