You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I faced an interesting problem with HTTP.rb and Webmock.
I'm using HTTP.rb for streaming files from S3 through the Sinatra application. And want to test it with RSpec. Files for test reasons are located at localhost, so I allowed requests to localhost like this:
@aka-nez Thank you for opening this issue, the detailed description. The provided sinatra app was very useful to debug the issue. You have correctly identified the root cause of the problem on WebMock side to be body.to_s call.
I have added a fix to the http_rb_adapter that fixed the problem: 216cad9
The fix is not ideal, as it replaces the original Response#body, but since original body cannot be reset for streaming, this is the best I came up with.
Thank you again for your contribution to identifying and helping me address this issue.
Hi! I faced an interesting problem with HTTP.rb and Webmock.
I'm using HTTP.rb for streaming files from S3 through the Sinatra application. And want to test it with RSpec. Files for test reasons are located at localhost, so I allowed requests to localhost like this:
I want to stream each received chunk via Sinatra streaming API like this:
And, of course, I want to test it. But here I meet a problem:
I looked at the source code, and probably found an issue.
body.to_s
is it a shortcut to read whole body and I think it broke HTTP.rb streaming feature.So, I want to find the best way to solve this long-term problem. Maybe someone can give me the right direction or any advice?
PS: I set a minimal application to show that case: https://github.com/aka-nez/sinatra-streaming-webmock-error
The related issue at HTTP.rb repo: httprb/http/issues/212
The text was updated successfully, but these errors were encountered: