From da25cd531fc7b5f03960f8612012cdc9bf26c4bd Mon Sep 17 00:00:00 2001 From: redkale Date: Mon, 4 Nov 2024 21:59:19 +0800 Subject: [PATCH] HttpResponse --- src/main/java/org/redkale/net/http/HttpResponse.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/redkale/net/http/HttpResponse.java b/src/main/java/org/redkale/net/http/HttpResponse.java index b5e139c31..4e6aa525a 100644 --- a/src/main/java/org/redkale/net/http/HttpResponse.java +++ b/src/main/java/org/redkale/net/http/HttpResponse.java @@ -1077,16 +1077,16 @@ public class HttpResponse extends Response { && !this.respHeadContainsConnection && !this.request.isWebSocket() && (this.contentType == null - || this.contentType == this.jsonContentType - || this.contentType == this.plainContentType) + || Objects.equals(this.contentType, this.jsonContentType) + || Objects.equals(this.contentType, this.plainContentType)) && (this.contentLength >= 0 && this.contentLength < jsonLiveContentLengthArray.length)) { byte[][] lengthArray = this.plainLiveContentLengthArray; if (this.request.isKeepAlive()) { - if (this.contentType == this.jsonContentType) { + if (Objects.equals(this.contentType, this.jsonContentType)) { lengthArray = this.jsonLiveContentLengthArray; } } else { - if (this.contentType == this.jsonContentType) { + if (Objects.equals(this.contentType, this.jsonContentType)) { lengthArray = this.jsonCloseContentLengthArray; } else { lengthArray = this.plainCloseContentLengthArray; @@ -1115,9 +1115,9 @@ public class HttpResponse extends Response { } } if (!this.request.isWebSocket()) { - if (this.contentType == this.jsonContentType) { + if (Objects.equals(this.contentType, this.jsonContentType)) { headerArray.put(this.jsonContentTypeBytes); - } else if (this.contentType == null || this.contentType == this.plainContentType) { + } else if (this.contentType == null || Objects.equals(this.contentType, this.plainContentType)) { headerArray.put(this.plainContentTypeBytes); } else { headerArray.put(("Content-Type: " + this.contentType + "\r\n").getBytes());