Skip to content

Refactor HttpClient polyfills: Uri overloads as primary, string overloads as delegates#124

Merged
Tyrrrz merged 2 commits intoprimefrom
copilot/refactor-uri-overloads-primary
Apr 19, 2026
Merged

Refactor HttpClient polyfills: Uri overloads as primary, string overloads as delegates#124
Tyrrrz merged 2 commits intoprimefrom
copilot/refactor-uri-overloads-primary

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

Previously, string overloads held the implementation and Uri overloads delegated via requestUri.ToString(). This is backwards — Uri is the richer, more precise type and should be primary.

Changes

  • GetStreamAsync, GetByteArrayAsync, GetStringAsync: moved full implementation into the Uri overloads
  • string overloads now delegate to their Uri counterparts via new Uri(requestUri)
// Uri overload — primary (contains logic)
public async Task<Stream> GetStreamAsync(Uri requestUri, CancellationToken cancellationToken = default) { ... }

// string overload — delegates
public async Task<Stream> GetStreamAsync(string requestUri, CancellationToken cancellationToken = default) =>
    await httpClient.GetStreamAsync(new Uri(requestUri), cancellationToken).ConfigureAwait(false);

…rloads delegate to them

Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/715cc890-8c16-4ee1-8fb3-41bf327f0073

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 19, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 19, 2026 09:55
Copilot AI review requested due to automatic review settings April 19, 2026 09:55
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.76%. Comparing base (03be12a) to head (a3cc217).
⚠️ Report is 1 commits behind head on prime.

Additional details and impacted files
@@            Coverage Diff             @@
##            prime     #124      +/-   ##
==========================================
+ Coverage   90.60%   90.76%   +0.16%     
==========================================
  Files         285      285              
  Lines        4959     4959              
  Branches      404      404              
==========================================
+ Hits         4493     4501       +8     
+ Misses        373      366       -7     
+ Partials       93       92       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors HttpClient polyfills so the Uri overloads contain the primary implementations and the string overloads delegate to them.

Changes:

  • Moved GetStreamAsync, GetByteArrayAsync, and GetStringAsync implementation logic into the Uri overloads
  • Updated string overloads to delegate to Uri overloads by constructing a Uri from the input string
  • Updated docs links/comments to match the new primary overloads

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PolyShim/Net50/HttpClient.cs Outdated
Comment thread PolyShim/Net50/HttpClient.cs Outdated
Comment thread PolyShim/Net50/HttpClient.cs Outdated
Comment thread PolyShim/Net50/HttpClient.cs Outdated
… BaseAddress compatibility

Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/d05650b1-31f5-41d3-9725-5b7bfe05aac1

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants