Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

imjoehaines
Copy link
Contributor

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

Copy link
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

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

Should we update the docs to recommend rewindable (or state that non-rewindable will result in less data being captured)?

@imjoehaines imjoehaines merged commit fa5d160 into next Jun 18, 2024
137 checks passed
@imjoehaines imjoehaines deleted the rack-rewindable-input branch June 18, 2024 08:10
@imjoehaines imjoehaines mentioned this pull request Jun 18, 2024
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.

2 participants