Update sample to use ASP.NET Core 2.1 and HttpClientFactory #23
This Pull Request updates the sample application to use ASP.NET 2.1 and HttpClientFactory (initially with preview 1, with the intention being to move to the final
The sample now uses Refit to show usage with typed clients, rather than using
Some ASP.NET Core 2.1 idioms as described in the announcement have also been added.
The processing of plugging this in has raised a few questions about HttpClientFactory itself, which I'll raise issues to ask in their repo. At a high-level these are:
As well as the final upgrade before merge, requires updates to the
Relates to #6.
@@ Coverage Diff @@ ## master #23 +/- ## ======================================= Coverage 99.86% 99.86% ======================================= Files 8 8 Lines 720 720 Branches 96 96 ======================================= Hits 719 719 Partials 1 1
Regarding question 2 in the description, this was caused by the handler registration in the test project running before the applications. Once I realised this, it was easy to refactor the code slightly to ensure the application always put its handlers at the top of the list of additional handlers.
Remove Microsoft.VisualStudio.Web.CodeGeneration.Tools as it breaks the build (and might be redundant what with global tools anyway).
Use the new Microsoft.AspNetCore.Mvc.Testing NuGet package to simplify the tests in the sample application.