Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code in ITypedHttpClientFactory<TClient> Interface page is broken #8305

Open
milleniumbug opened this issue Aug 14, 2022 · 1 comment
Labels
area-System.Net Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@milleniumbug
Copy link

milleniumbug commented Aug 14, 2022

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/Microsoft.Extensions.Http/ITypedHttpClientFactory%601.xml

// in Controllers/HomeController.cs
public class HomeController : ControllerBase(IApplicationBuilder app, ExampleClient exampleClient)
{
    private readonly ExampleClient _exampleClient;

    public HomeController(ExampleClient exampleClient)
    {
        _exampleClient = exampleClient;
    }

    public async Task<IActionResult> Index()
    {
        var response = await _exampleClient.GetAsync("/helloworld");
        var text = await response.Content.ReadAsStringAsync();
        return Content("Remote server said: " + text, "text/plain");
    };
}

1.) I don't think the ControllerBase(IApplicationBuilder app, ExampleClient exampleClient) syntax exists
2.) ExampleClient does not have a GetAsync method
3.) semicolon after Index()'s method body

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Aug 14, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 14, 2022
@ghost
Copy link

ghost commented Aug 14, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/Microsoft.Extensions.Http/ITypedHttpClientFactory%601.xml

// in Controllers/HomeController.cs
public class HomeController : ControllerBase(IApplicationBuilder app, ExampleClient exampleClient)
{
    private readonly ExampleClient _exampleClient;

    public HomeController(ExampleClient exampleClient)
    {
        _exampleClient = exampleClient;
    }

    public async Task<IActionResult> Index()
    {
        var response = await _exampleClient.GetAsync("/helloworld");
        var text = await response.Content.ReadAsStringAsync();
        return Content("Remote server said: " + text, "text/plain");
    };
}

1.) I don't think the ControllerBase(IApplicationBuilder app, ExampleClient exampleClient) syntax exists
2.) ExampleClient does not have a GetAsync method
3.) semicolon after Index()'s method body

Author: milleniumbug
Assignees: -
Labels:

area-System.Net, untriaged, Pri3

Milestone: -

@CarnaViire CarnaViire self-assigned this Oct 6, 2022
@CarnaViire CarnaViire removed their assignment Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

2 participants