Skip to content

HttpClient base address is missing trailing slash #16008

@danroth27

Description

@danroth27

The HttpClient base address reflects the base path of the app, which is great, but it's missing the trailing slash:

<base href="/foo/" />
@inject HttpClient Http

@functions {
    protected override async Task OnInitAsync()
    {
        Console.WriteLine(Http.BaseAddress); // Expected: <base-uri>/foo/, Actual: <base-uri>/foo
    }
}

The problem seems to be here:

https://github.com/aspnet/Blazor/blob/a9c45fe78ac18b6bd524904b40896c249f9f09c0/src/Microsoft.AspNetCore.Blazor.Browser/Services/BrowserUriHelper.cs#L146-L158

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions