luckyframework / lucky

A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.
https://luckyframework.org
MIT License
2.57k stars 156 forks source link

Investigate writing empty body responses #1740

Open jwoertink opened 1 year ago

jwoertink commented 1 year ago

Right now, we always call response.print(body) unless you're doing a HEAD call.

https://github.com/luckyframework/lucky/blob/0b26cf4d0c38be6311206b57e1dcc24f4bda1d58/src/lucky/text_response.cr#L32

This means that even on a redirect, we're still calling response.print(""). My guess would be that we don't need to do that... The response object is just inherited from IO, so this is calling IO#print https://crystal-lang.org/api/1.5.1/IO.html#print%28obj%3A_%29%3ANil-instance-method