Skip to content

Changed the IconService to only set the HttpClient.BaseAddress if it …#220

Merged
vnbaaij merged 1 commit intomicrosoft:mainfrom
eeegs:IconService
Sep 12, 2022
Merged

Changed the IconService to only set the HttpClient.BaseAddress if it …#220
vnbaaij merged 1 commit intomicrosoft:mainfrom
eeegs:IconService

Conversation

@eeegs
Copy link
Copy Markdown
Contributor

@eeegs eeegs commented Sep 12, 2022

…doesn't have one.

Pull Request

📖 Description

Updated the IconService to only update the HttpClient.BaseAddress if it didn't have one.

🎫 Issues

HttpClient.BaseAddress was being set in the IconService constructor because standalone testing of a Blazor client app (not hosted) or a server app, didn't always see one being set. In this same testing the HttpClient had not been used yet so it was ok to set (or potentially reset) this property.

If a hosted (or probably any model Blazor app) that gets data, may have used the HttpClient before the IconService is constructed, at which time the setting of the HttpClient.BaseAddress failed as it can only be set before the HttpClient is used.

👩‍💻 Reviewer Notes

Simple fix was to utilize the null-coalescing operator.

📑 Test Plan

Non, all exiting test should still pass, and any new test involving using the HttpClient before the IconService should now also pass.

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have modified an existing component

⏭ Next Steps

@vnbaaij vnbaaij merged commit 6471b78 into microsoft:main Sep 12, 2022
@eeegs eeegs deleted the IconService branch September 13, 2022 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants