avaje / avaje-jex

Web routing for the JDK Http server
Apache License 2.0
23 stars 1 forks source link

Add a way to send a 204 no body? #90

Closed rbygrave closed 6 days ago

rbygrave commented 1 week ago

I don't think we have a nice/good way to send a 204 response without a body via Context interface?

It would be context.write(new byte[0]) ... write an empty byte array. Do we need a better option like content.sendEmpty(204)? With Nima/Helidon its res.status(NO_CONTENT_204).send();

SentryMan commented 1 week ago

handled by https://github.com/avaje/avaje-jex/pull/78, if you don't write any response a 204 with no body is sent automatically.

rbygrave commented 6 days ago

Hmm ok. Will go with that. Pondering if I like the explicit approach like helidon ... will ponder that some more.

SentryMan commented 6 days ago

I mean anything we add will be nothing but a placebo

rbygrave commented 6 days ago

Yeah, just pondering that sometimes its nice when things are explicit ... in the avaje-http generated code for Nima ... when a controller method returns null we explicitly generate code to send a 204 no body response - part of me like that in that its nice and explicit.