-
-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Milestone
Description
Description
When using the Falcon app server (which uses protocol-rack internally), request bodies cannot be properly rewound for subsequent reads. After the first read, subsequent reads return an empty string even after calling rewind.
Steps to Reproduce
- Create a simple Rack application that reads a request body twice
- Run it with Falcon server
- POST data to the endpoint
- Observe that the second read returns an empty string
Test
# typed: true
# frozen_string_literal: true
require "rack"
class BodyTestApp
def call(env)
# Get the request body
body = env["rack.input"]
# First read
body.rewind
first_read = body.read
# Second read
body.rewind
second_read = body.read
# Response showing both reads
response_body = "First read: #{first_read.inspect}\n\nSecond read: #{second_read.inspect}"
[200, { "Content-Type" => "text/plain" }, [response_body]]
end
end
Output
➜ curl -X POST -d "This is test data" http://localhost:9292
First read: "This is test data"
Second read: ""
Expected Behavior
Both reads should return the same data after calling rewind.
ioquatix
Metadata
Metadata
Assignees
Labels
No labels