Skip to content

Commit 57a842d

Browse files
authored
Simplify response status code check (#3390)
1 parent 178275c commit 57a842d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

reactor-netty-http/src/main/java/reactor/netty/http/server/AbstractHttpServerMetricsHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public void channelInactive(ChannelHandlerContext ctx) {
157157
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
158158
try {
159159
if (msg instanceof HttpResponse) {
160-
if (((HttpResponse) msg).status().equals(HttpResponseStatus.CONTINUE)) {
160+
if (((HttpResponse) msg).status().code() == HttpResponseStatus.CONTINUE.code()) {
161161
//"FutureReturnValueIgnored" this is deliberate
162162
ctx.write(msg, promise);
163163
return;

reactor-netty-http/src/main/java/reactor/netty/http/server/Http2StreamBridgeServerHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
187187
//"FutureReturnValueIgnored" this is deliberate
188188
ctx.write(new DefaultHttpContent((ByteBuf) msg), promise);
189189
}
190-
else if (msg instanceof HttpResponse && HttpResponseStatus.CONTINUE.equals(((HttpResponse) msg).status())) {
190+
else if (msg instanceof HttpResponse && HttpResponseStatus.CONTINUE.code() == ((HttpResponse) msg).status().code()) {
191191
//"FutureReturnValueIgnored" this is deliberate
192192
ctx.write(msg, promise);
193193
}

reactor-netty-http/src/main/java/reactor/netty/http/server/HttpTrafficHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ else if (msg instanceof HttpResponse) {
410410
setKeepAlive(response, false);
411411
}
412412

413-
if (response.status().equals(HttpResponseStatus.CONTINUE)) {
413+
if (response.status().code() == HttpResponseStatus.CONTINUE.code()) {
414414
//"FutureReturnValueIgnored" this is deliberate
415415
ctx.write(msg, promise);
416416
return;
@@ -450,7 +450,7 @@ boolean handleDefaultFullHttpResponse(DefaultFullHttpResponse response, ChannelP
450450
setKeepAlive(response, false);
451451
}
452452

453-
if (response.status().equals(HttpResponseStatus.CONTINUE)) {
453+
if (response.status().code() == HttpResponseStatus.CONTINUE.code()) {
454454
//"FutureReturnValueIgnored" this is deliberate
455455
ctx.write(response, promise);
456456
return true;

reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogHandlerH1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
5454
final HttpResponse response = (HttpResponse) msg;
5555
final HttpResponseStatus status = response.status();
5656

57-
if (status.equals(HttpResponseStatus.CONTINUE)) {
57+
if (status.code() == HttpResponseStatus.CONTINUE.code()) {
5858
//"FutureReturnValueIgnored" this is deliberate
5959
ctx.write(msg, promise);
6060
return;

0 commit comments

Comments
 (0)