dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.62k stars 25.3k forks source link

Just a bit more of a pointer in the right direction #23649

Closed johndhunter closed 3 years ago

johndhunter commented 3 years ago

Hi,

Your examples are really good and useful (especially with respect to typed clients) but I think lacking in one respect. The importance of referencing Microsoft.Http.Extensions.

I know it's in the text - but a heads up to indicate that AddHttpClient is not available without that added reference wouldn't go amiss e.g.

using Microsoft.AspNetCore.Components.WebAssembly.Authentication;

// AddHttpClient is an extension in Microsoft.Http.Extensions
builder.Services.AddHttpClient("WebAPI", 
        client => client.BaseAddress = new Uri("https://www.example.com/base"))
    .AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();

builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>()
    .CreateClient("WebAPI"));

just for the "skimmers" amongst us 😊


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

guardrex commented 3 years ago

Thanks @johndhunter ... Yes, that's been an on-going improvement to get them called out everywhere. I'll take care of this shortly, probably by EOD.

guardrex commented 3 years ago

This particular node hasn't been reached yet on the UE pass ("user experience" pass, i.e., total overhaul) tracking issue. If we continue to work them forward in 2022, there will be many improvements to the coverage in this node.

https://github.com/dotnet/AspNetCore.Docs/issues/19286

Two things that I've been improving are the call-outs for namespaces/packages and having fully-working, cut-'n-paste examples.

johndhunter commented 3 years ago

Thanks - first time contributor

guardrex commented 3 years ago

Sorry for having to refuse the PR in that form. We ❤️ community PRs. However, we can't take code comments unless necessary due to the localization concerns. There's been a lot of work over the last few years to get them moved into the text. If we surface this in that way, we'd be going backwards on it.

guardrex commented 3 years ago

Leave this open ... it will close automatically when the PR merges later.

guardrex commented 3 years ago

Closed by https://github.com/dotnet/AspNetCore.Docs/pull/23650.