elixir-plug / plug

Compose web applications with functions
https://hex.pm/packages/plug
Other
2.85k stars 586 forks source link

Update adapter docs suggested behaviour regarding `chunk/2` return types #1204

Closed mtrudel closed 8 months ago

mtrudel commented 8 months ago

Mostly intended to remove the suggestion that adapter implementations return a simple :ok from chunk/2 calls.

Blind adherence to this suggestion early on the development of Bandit has caused me no end of grief by preventing the adapter from being able to track state for aspects of metrics, H2 send window management, etc. I was today years old when I actually realized that Plug would have let me track chunking state this whole time. The change in wording here is to save the next webserver implementor from the same fate.

josevalim commented 8 months ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

mtrudel commented 8 months ago

Could I entice y'all to push a release soon? Turns out that the typespec change in this PR is actually important downstream; dialyzer complains otherwise if you attempt to return nil as a body

josevalim commented 8 months ago

Done!