ETOOBUSY 🚀 minimal blogging for the impatient
204AND pass an empty
Every now and then I’m coding a web API and I need to send back an empty
response, which is HTTP status code
204 (also known as No Content).
$c->render(status => 204, data => '');
It has tripped me so many times:
- about 90% of them I use(d)
- I keep (hopefully kept) to leave out the
datapart because it just seems right (if status is 204, why bother?).
I hope writing this will help me avoid the bug the next time!
Update: this suggestion from
preaction in the comments below is
shorter and maybe easier to remember:
I say maybe because I pretty much never use
rendered, so it’s likely
I’ll forget it 🙄