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

Add support for callable bodies. #140

Closed
wants to merge 1 commit into from
Closed

Add support for callable bodies. #140

wants to merge 1 commit into from

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Apr 19, 2021

Description

Add support for callable bodies for streaming responses.

app = lambda do |env|
	body = lambda do |stream|
		stream.write("Hello Streaming World")
		stream.close
	end
	
	[200, {}, body]
end

run app

Types of Changes

  • New feature.

Testing

  • I added tests for my changes.
  • I tested my changes locally.

@ioquatix
Copy link
Member Author

ioquatix commented Apr 19, 2021

Rack v1.0 is failing because Rack::Lint#call cannot be disambiguated. To be honest, I don't think Rack 1.0 is relevant anyway, so I've opted to remove it instead. However, this does give an example of failing middleware which uses the body = self.dup technique.

@ioquatix
Copy link
Member Author

The 4 failing checks are just jruby/truffleruby and unfortunately are to be expected.

@eregon
Copy link

eregon commented Apr 19, 2021

The 4 failing checks are just jruby/truffleruby and unfortunately are to be expected.

Do you know what's the issue on TruffleRuby here?
Something is different regarding threads/fibers?

https://github.com/socketry/falcon/runs/2380732695 says Address already in use

@ioquatix
Copy link
Member Author

Yeah, it's kind of weird, maybe the flags for socket reuse address/port are not working correctly? You should be able to reproduce the issues locally pretty easily.

@ioquatix
Copy link
Member Author

ioquatix commented Aug 3, 2022

#181

@ioquatix ioquatix closed this Aug 3, 2022
@ioquatix ioquatix deleted the streaming branch August 3, 2022 12:39
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