ASP.NET Core request body capturing erases the body
See original GitHub issueReproducer also included in the comment - copying here:
[HttpPost("send")]
public JsonResult Send([FromBody] BaseReportFilter<SendMessageFilter> filter)
{
//Do something
return new JsonResult("");
}
public class BaseReportFilter<T>
{
public T ReportFilter { get; set; }
}
public class SendMessageFilter{
public string SenderApplicationCode { get; set; }
public string MediaType { get; set; }
public string Body { get; set; }
public List<string> Recipients { get; set; }
}
//appsettings.json:
"ElasticApm": {
"ServerUrls": "http://localhost:8200",
"ServiceName": "ServiceName",
"CaptureHeaders": true,
"CaptureBody": "all",
"CaptureBodyContentTypes": "application/x-www-form-urlencoded*, text/*, application/json*, application/xml*",
"LogLevel": "Info",
"StackTraceLimit": -1
}
"CaptureBodyContentTypes": "application/x-www-form-urlencoded*, text/*, application/json*, application/xml*",
Without agent the filter
parameter is populated, once the agent is activated it became null
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11 (10 by maintainers)
Top Results From Across the Web
How do I get the incoming request body and the outgoing ...
I'm writing some middleware for an ASP.NET Core 7 minimal API project. At this stage, I would just like to be able to...
Read more >Use HttpContext in ASP.NET Core
Reads the request body. Rewinds the request body to the start so other middleware or the endpoint can read it. C# Copy.
Read more >Logging the Body of HTTP Request and Response in ASP . ...
Logging the Body of HTTP Request and Response in ASP .NET Core · In this first post, we will explore how to capture...
Read more >ASP.NET Core Web API - POST PUT DELETE
This part is focused on handling POST PUT DELETE requests in .NET Core by using previously created repository pattern for business logic.
Read more >Reading the raw request body as a string in ASP.NET Core
ASP.NET MVC model binding is great, but occasionally you just need to access the body of a request as a raw string within...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m very sorry about that! To be fair: this feature is off by default and you could immediately recover by turning the feature off, right? Or do I miss something? Not that I want to make this sound like a non-issue - it was indeed an important fix-, but I want to make sure I see the impact of this correctly.
The release is out: https://github.com/elastic/apm-agent-dotnet/releases/tag/1.1.2
Version
1.1.2
packages include the fix. Also updated on nuget.org.This works fine if I comment out
request.Body = initialBody
inExtractRequestBody
method inRequestExtentions.cs
. I hope this helps solve the problem.