66package io .jooby .internal .netty ;
77
88import static io .jooby .internal .netty .NettyHeadersFactory .HEADERS ;
9+ import static io .jooby .internal .netty .NettyString .CONTENT_LENGTH ;
10+ import static io .jooby .internal .netty .NettyString .ZERO ;
911import static io .netty .buffer .Unpooled .wrappedBuffer ;
10- import static io .netty .handler .codec .http .HttpHeaderNames .CONTENT_LENGTH ;
1112import static io .netty .handler .codec .http .HttpHeaderNames .CONTENT_TYPE ;
1213import static io .netty .handler .codec .http .HttpHeaderNames .RANGE ;
1314import static io .netty .handler .codec .http .HttpHeaderNames .SET_COOKIE ;
@@ -546,13 +547,13 @@ public Context send(@NonNull String data) {
546547 return send (data , UTF_8 );
547548 }
548549
549- @ Override
550- public final Context send (String data , Charset charset ) {
550+ @ NonNull @ Override
551+ public final Context send (@ NonNull String data , @ NonNull Charset charset ) {
551552 return send (wrappedBuffer (data .getBytes (charset )));
552553 }
553554
554- @ Override
555- public final Context send (byte [] data ) {
555+ @ NonNull @ Override
556+ public final Context send (@ NonNull byte [] data ) {
556557 return send (wrappedBuffer (data ));
557558 }
558559
@@ -566,8 +567,8 @@ public Context send(@NonNull ByteBuffer[] data) {
566567 return send (Unpooled .wrappedBuffer (data ));
567568 }
568569
569- @ Override
570- public final Context send (ByteBuffer data ) {
570+ @ NonNull @ Override
571+ public final Context send (@ NonNull ByteBuffer data ) {
571572 return send (wrappedBuffer (data ));
572573 }
573574
@@ -738,12 +739,12 @@ public Context setResetHeadersOnError(boolean value) {
738739 }
739740
740741 @ NonNull @ Override
741- public Context send (StatusCode statusCode ) {
742+ public Context send (@ NonNull StatusCode statusCode ) {
742743 try {
743- setResponseCode (statusCode );
744+ setResponseCode (statusCode . value () );
744745 responseStarted = true ;
745- if (! setHeaders . contains ( CONTENT_LENGTH ) ) {
746- setHeaders .set (CONTENT_LENGTH , "0" );
746+ if (contentLength == - 1 ) {
747+ setHeaders .set (CONTENT_LENGTH , ZERO );
747748 }
748749 var rsp =
749750 new DefaultFullHttpResponse (
0 commit comments