mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
[PR #1172] [MERGED] Fix JSON parsing of text/plain content type #1265
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/wiremock/WireMock.Net/pull/1172
Author: @ruxo
Created: 9/15/2024
Status: ✅ Merged
Merged: 9/20/2024
Merged by: @StefH
Base:
master← Head:FixJsonDetection📝 Commits (7)
5edf150UseContentType4c35696Fix unit tests579354cAdd a unit test and an integration test for the fix.e732721Simplify body type checking with GetBodyType extension.f746584Split IBodyDataExtension, and use imperative style instead of functional style31516a7Remove excessive null forgiving operators8e0e2d2Adjust braces📊 Changes
5 files changed (+174 additions, -17 deletions)
View changed files
➕
src/WireMock.Net.Abstractions/Models/IBodyDataExtension.cs(+20 -0)📝
src/WireMock.Net/Http/HttpRequestMessageHelper.cs(+8 -5)📝
src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs(+19 -11)📝
test/WireMock.Net.Tests/Http/HttpRequestMessageHelperTests.cs(+21 -1)➕
test/WireMock.Net.Tests/ResponseBuilders/ResponseWithProxyIntegrationTests.cs(+106 -0)📄 Description
Hello,
I am submitting a pull request to address the behavior of request body parsing, as discussed in issue #1168. My fix attempts to correct this behavior.
However, I'm not entirely sure if this fix is appropriate, as I don't fully understand why the current code relies on the body's detected type instead of the body's content type in both the request and response flows. I believe that the correction should prioritize the content type first, using the body's detected type as a fallback. But I'm not aware of all the history behind this implementation.
Could you please provide guidance or suggest any improvements?
Best regards,
Rux
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.