luckyframework / luckyframework/lucky
Investigate writing empty body responses
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 2.7k
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/lucky/text_response.cr at the response.print(body) call, then read Crystal's IO#print documentation to understand the effect of printing an empty string. Determine whether empty-body responses such as redirects should skip this call; the issue is complete when that behavior is confirmed and covered appropriately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100