diff --git a/src/main/java/reactor/ipc/netty/http/server/HttpServerOperations.java b/src/main/java/reactor/ipc/netty/http/server/HttpServerOperations.java index 0b6fd35222..e156b476c0 100644 --- a/src/main/java/reactor/ipc/netty/http/server/HttpServerOperations.java +++ b/src/main/java/reactor/ipc/netty/http/server/HttpServerOperations.java @@ -501,7 +501,12 @@ protected void onOutboundError(Throwable err) { @Override protected HttpMessage outboundHttpMessage() { - return nettyResponse; + if (HttpResponseStatus.NOT_MODIFIED.equals(status())) { + return newFullEmptyBodyMessage(); + } + else { + return nettyResponse; + } } final Mono withWebsocketSupport(String url, diff --git a/src/test/java/reactor/ipc/netty/http/server/HttpServerTests.java b/src/test/java/reactor/ipc/netty/http/server/HttpServerTests.java index 0799d7a38f..55fb831ee7 100644 --- a/src/test/java/reactor/ipc/netty/http/server/HttpServerTests.java +++ b/src/test/java/reactor/ipc/netty/http/server/HttpServerTests.java @@ -462,12 +462,12 @@ private void checkResponse(String url, InetSocketAddress address) { .expectNextMatches(t -> { int code = t.getT1(); HttpHeaders h = t.getT2(); - if (code == 204 || code == 304) { + if (code == 204) { return !h.contains("Transfer-Encoding") && !h.contains("Content-Length") && "NO BODY".equals(t.getT3()); } - else if (code == 205) { + else if (code == 205 || code == 304) { return !h.contains("Transfer-Encoding") && h.getInt("Content-Length").equals(0) && "NO BODY".equals(t.getT3());