Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Nov 11, 2023
1 parent 5ca4993 commit 4c9c992
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.Extensions.Configuration;

public static class IConfigurationBuilderExtensions
{
public static void AddClientAppConfigurations(this IConfigurationBuilder builder)
public static void AddClientConfigurations(this IConfigurationBuilder builder)
{
var assembly = Assembly.Load("BlazorWeb.Client");
builder.AddJsonStream(assembly.GetManifestResourceStream("BlazorWeb.Client.appsettings.json")!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var builder = WebAssemblyHostBuilder.CreateDefault(args);

builder.Configuration.AddClientAppConfigurations();
builder.Configuration.AddClientConfigurations();

Uri.TryCreate(builder.Configuration.GetApiServerAddress(), UriKind.RelativeOrAbsolute, out var apiServerAddress);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public static class HttpRequestExtensions
/// <summary>
/// https://blog.elmah.io/how-to-get-base-url-in-asp-net-core/
/// </summary>
public static string BaseUrl(this HttpRequest req)
public static string GetBaseUrl(this HttpRequest req)
{
var uriBuilder = new UriBuilder(req.Scheme, req.Host.Host, req.Host.Port ?? -1);
if (uriBuilder.Uri.IsDefaultPort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void AddBlazor(this IServiceCollection services, IConfiguration co

if (apiServerAddress!.IsAbsoluteUri is false)
{
apiServerAddress = new Uri($"{sp.GetRequiredService<IHttpContextAccessor>().HttpContext!.Request.BaseUrl()}{apiServerAddress}");
apiServerAddress = new Uri($"{sp.GetRequiredService<IHttpContextAccessor>().HttpContext!.Request.GetBaseUrl()}{apiServerAddress}");
}

httpClient.BaseAddress = apiServerAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var builder = WebApplication.CreateBuilder(args);

// We need to load the client app configurations to prerender the app on server side.
builder.Configuration.AddClientAppConfigurations();
builder.Configuration.AddClientConfigurations();

BlazorWeb.Server.Startup.Services.Add(builder.Services, builder.Environment, builder.Configuration);

Expand Down

0 comments on commit 4c9c992

Please sign in to comment.