diff --git a/aspnetcore/blazor/security/blazor-web-app-with-oidc.md b/aspnetcore/blazor/security/blazor-web-app-with-oidc.md index 904e67677cb4..d33e20ab2065 100644 --- a/aspnetcore/blazor/security/blazor-web-app-with-oidc.md +++ b/aspnetcore/blazor/security/blazor-web-app-with-oidc.md @@ -554,12 +554,9 @@ The `Weather` component uses the [`[Authorize]` attribute](xref:Microsoft.AspNet The `ExternalApi` HTTP client is used to make a request for weather data to the secure web API. In the [`OnInitializedAsync` lifecycle event](xref:blazor/components/lifecycle#component-initialization-oninitializedasync) of `Weather.razor`: ```csharp -using var request = - new HttpRequestMessage(HttpMethod.Get, "/weather-forecast"); -using var client = ClientFactory.CreateClient("ExternalApi"); - +using var request = new HttpRequestMessage(HttpMethod.Get, "/weather-forecast"); +var client = ClientFactory.CreateClient("ExternalApi"); using var response = await client.SendAsync(request); - response.EnsureSuccessStatusCode(); forecasts = await response.Content.ReadFromJsonAsync() ?? diff --git a/aspnetcore/blazor/security/index.md b/aspnetcore/blazor/security/index.md index 2cf4dc88f91b..b08208d33075 100644 --- a/aspnetcore/blazor/security/index.md +++ b/aspnetcore/blazor/security/index.md @@ -812,9 +812,7 @@ internal sealed class ServerWeatherForecaster(HttpClient httpClient, using var request = new HttpRequestMessage(HttpMethod.Get, "/weather-forecast"); request.Headers.Authorization = new("Bearer", accessToken); - using var response = await httpClient.SendAsync(request); - response.EnsureSuccessStatusCode(); return await response.Content.ReadFromJsonAsync() ??