Skip to content

Add support for callable bodies.#140

Closed
ioquatix wants to merge 1 commit intomainfrom
streaming
Closed

Add support for callable bodies.#140
ioquatix wants to merge 1 commit intomainfrom
streaming

Conversation

@ioquatix
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

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

@eregon
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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