bugsnag / bugsnag-ruby

BugSnag error monitoring & reporting software for rails, sinatra, rack and ruby
https://docs.bugsnag.com/platforms/ruby
MIT License
246 stars 174 forks source link

Only read Rack request body if it's rewindable #829

Closed imjoehaines closed 1 month ago

imjoehaines commented 1 month ago

Goal

Rack 3 made it possible for the request body to not be rewindable, meaning it can only be read once

We rely on reading the request body for two pieces of metadata, request.params (if it's a form request) and request.body. These won't be set if the body has already been read, which is quite likely

With request.params we will only read the query string if the request cannot be rewound

With request.body we will not read it at all if the request cannot be rewound