Skip to content

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Jul 21, 2025

Resolves #4353

Explanation

It doesn't look like the changes to BaseRequestPayloadExtractor were ever required. When I put a breakpoint here I see the stream is of type FileBufferingReadStream (indicating the EnableBuffering middleware is doing what it's supposed to).

Sanity check

There are already various unit tests for this but , as a sanity check, you can post a compressed body to the following program with something like:

echo -n 'your message here' | gzip | curl -X POST http://localhost:8080/message \
  --data-binary @- \
  -H "Content-Encoding: gzip" \
  -H "Content-Type: text/plain"
using Sentry.Extensibility;

var builder = WebApplication.CreateBuilder(args);

builder.WebHost.UseSentry(options =>
{
    // Log debug information about the Sentry SDK
    options.MaxRequestBodySize = RequestSize.Always;
    options.SendDefaultPii = true;
});

builder.Services.AddRequestDecompression();

var app = builder.Build();

app.UseRequestDecompression();

app.MapPost("message", _ =>
{
    // This is an example of a POST endpoint that captures the request body
    // and sends it to Sentry.
    SentrySdk.CaptureMessage("Hello from a POST endpoint!");

    return Task.CompletedTask;
});

@jamescrosswell jamescrosswell marked this pull request as ready for review July 21, 2025 10:26
Copy link
Member

@Flash0ver Flash0ver left a comment

Choose a reason for hiding this comment

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

🤘

@jamescrosswell jamescrosswell merged commit e1d905c into main Jul 22, 2025
30 checks passed
@jamescrosswell jamescrosswell deleted the fix-base-payload-extractor branch July 22, 2025 21:10
This was referenced Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request.Body can only be read once when AddRequestDecompression is used
2 participants