Replies: 2 comments
-
Converted this to a discussion because it isn't clear to me if something needs to be changed in Sinatra. I don't have any explanation, I think you need to dive deeper yourself. Have you read the rack-test source code? |
Beta Was this translation helpful? Give feedback.
-
@dentarg I'm not using I can look intro this in details when I have more time, but the fact that |
Beta Was this translation helpful? Give feedback.
-
I'm using the helper
Sinatra::Streaming
from thesinatra-contrib
gem, where the yielded object of thestream
method is meant to be IO-like. Hence I'm usingIO.copy_stream
to feed this IO-like object some data. All works fine when serving via Puma, however when testing the code with rack-test the response body is empty. I managed to pull the important parts fromrack-test
and got the minimal amount of code to reproduce the issue:As you can see, just doing
io.write 'ok'
works fine, howeverIO.copy_stream
for some reason results into an empty mock response body. Does not really matter if the first argument isStringIO
,File
, or whatever.Any ideas?
Sinatra and contrib versions: 3.0.2
Rack version: 2.2.4
Ruby version: 3.0.3
Beta Was this translation helpful? Give feedback.
All reactions