fix: do not check type of HttpContent#387
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes an issue where HttpContent parameter matching was overly strict by removing type checking for HttpContent instances. The change allows matching based on content rather than concrete type.
Changes:
- Removed
StringContenttype check inIsStringContentmatcher - Replaced direct content reading methods with stream-based reading to support any
HttpContenttype - Added test coverage for non-matching types and type-agnostic content matching
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Source/Mockolate/Web/ItExtensions.HttpContent.IsStringContent.cs | Removed type check and switched to stream-based content reading |
| Source/Mockolate/Web/ItExtensions.HttpContent.IsBinaryContent.cs | Switched to stream-based content reading with proper stream position reset |
| Tests/Mockolate.Tests/Web/ItExtensionsTests.IsStringContentTests.cs | Added test verifying ByteArrayContent matches IsStringContent matcher |
| Tests/Mockolate.Tests/Web/ItExtensionsTests.UriTests.cs | Added test for type mismatch scenarios |
🚀 Benchmark ResultsDetails
|
e4fc964 to
35ae701
Compare
|
|
This is addressed in release v1.0.2. |



This pull request fixes an issue where
HttpContentparameter matching was overly strict by removing type checking forHttpContentinstances. The change allows matching based on content rather than concrete type.Key Changes:
StringContenttype check inIsStringContentmatcherHttpContenttype