Skip to content

Add extensions for Stream, HttpContent, HttpClient that make use of progress reporting#28

Merged
Tyrrrz merged 42 commits intoprimefrom
copilot/add-public-extensions-for-progress-reporting
Apr 20, 2026
Merged

Add extensions for Stream, HttpContent, HttpClient that make use of progress reporting#28
Tyrrrz merged 42 commits intoprimefrom
copilot/add-public-extensions-for-progress-reporting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

  • Replace FakeHttpMessageHandler with real HTTP requests to example.com
  • Remove null progress test cases
  • Only test string overloads; string overloads delegate to Uri overloads
  • Use UriKind.RelativeOrAbsolute in all string-to-Uri conversions in HttpClientExtensions
  • Inline HttpClient and URL directly into each test method
  • Remove HttpContentSpecs.cs — covered by HttpClient tests via delegation
  • Remove StreamSpecs.cs and HttpClientSpecs.cs; merge 2 most important stream tests + all HttpClient tests into new ExtensionSpecs.cs
  • Fix CI failures: use https://github.com/Tyrrrz/Gress (returns Content-Length) and restore progress assertions
  • Use ArrayPool<byte> and Random.Shared to fill stream test data
  • Add using var to MemoryStream variables in ExtensionSpecs.cs
  • Add .ConfigureAwait(false) to all async/awaits in all non-test files
  • Fix File.Create to use FileStream with FileOptions.Asynchronous
  • Reorder methods so callees appear before their callers in HttpClientExtensions.cs
  • Use RentOwner from PowerKit in ExtensionSpecs.cs stream tests
  • Add ArrayPool for buffer in StreamExtensions.cs with pattern matching
  • Use pattern matching in StreamExtensions.cs while loops
  • Add private TryGetEncoding extension on HttpContent in HttpContentExtensions.cs
  • Update PowerKit to v1.0.0 and use ISpanOwner.Span syntax
  • Add async/await to all string delegating overloads in HttpClientExtensions.cs
  • Use PowerKit's CopyToStreamAsync with IProgress<double>? in HttpContentExtensions.cs, converting via ToDoubleBased()
  • Fix build failures: exclude incompatible PowerKit v1.0.0 DirectoryExtensions.cs for older TFMs
  • Fix test failures: investigate and fix progress reporting for HTTP download tests
  • Investigate using PowerKit's Stream CopyToAsync in StreamExtensions.cs similarly

Copilot AI and others added 9 commits April 19, 2026 07:47
…Content extensions

Agent-Logs-Url: https://github.com/Tyrrrz/Gress/sessions/2c0d264e-47e1-486a-a15f-d010c47d0822

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…etByteArrayAsync/GetStringAsync to HttpClient

Agent-Logs-Url: https://github.com/Tyrrrz/Gress/sessions/cd3ff8f2-2fb5-4700-812a-f2bbeb5780f8

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/Gress/sessions/4ea143b5-a654-4849-9ff8-a280e4c38137

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/Gress/sessions/03f9803b-12e0-4477-97b0-2a683a2d4c41

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/Gress/sessions/9d9b089f-5e0d-4fb0-855c-82512be2f02c

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Comment thread Gress.Tests/HttpClientSpecs.cs Outdated
Comment thread Gress.Tests/HttpClientSpecs.cs Outdated
Comment thread Gress.Tests/HttpClientSpecs.cs Outdated
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 19, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Gress/Gress/Gress.Tests/bin/Debug/net10.0/Gress.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/Gress/Gress/Gress.Tests/bin/Debug/net10.0/Gress.Tests.deps.json /home/REDACTED/work/Gress/Gress/Gress.Tests/bin/Debug/net10.0/testhost.dll --port 36169 --endpoint 127.0.0.1:036169 --role client --parentprocessid 4329 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Use PowerKit TempFile in file-download tests; add PowerKit to test project Refactor HttpClientSpecs to use real HTTP requests and PowerKit TempFile Apr 19, 2026
Copilot AI requested a review from Tyrrrz April 19, 2026 09:45
… in production code

Agent-Logs-Url: https://github.com/Tyrrrz/Gress/sessions/6b5c3d6a-37c1-4e93-94c8-de21331f91f4

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

Copilot AI commented Apr 19, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Tyrrrz Tyrrrz changed the title Refactor HttpClientSpecs to use real HTTP requests and PowerKit TempFile Add extensions for Stream, HttpContent, HttpClient that make use of progress reporting Apr 19, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 19, 2026 09:52
Copilot AI review requested due to automatic review settings April 19, 2026 09:52
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 19, 2026

@copilot update PolyShim to latest pre-release version and rebuild

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 88.76404% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.66%. Comparing base (1d36b81) to head (6a95d2e).
⚠️ Report is 1 commits behind head on prime.

Files with missing lines Patch % Lines
Gress/Integration/HttpContentExtensions.cs 78.12% 5 Missing and 2 partials ⚠️
Gress/Integration/StreamExtensions.cs 87.50% 0 Missing and 2 partials ⚠️
Gress/Integration/HttpClientExtensions.cs 97.56% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #28      +/-   ##
==========================================
- Coverage   90.10%   89.66%   -0.45%     
==========================================
  Files          10       13       +3     
  Lines         182      271      +89     
  Branches       18       23       +5     
==========================================
+ Hits          164      243      +79     
- Misses         13       18       +5     
- Partials        5       10       +5     

☔ 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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.


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

Comment thread Gress/Integration/HttpContentExtensions.cs Outdated
Comment thread Gress.Tests/IntegrationSpecs.cs
Comment thread Gress.Tests/IntegrationSpecs.cs
Comment thread Readme.md
Comment thread Readme.md
Comment thread Gress/Integration/StreamExtensions.cs Outdated
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