You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by mi...@apache.org on 2019/12/26 15:03:01 UTC
[httpcomponents-core] 02/06: Use HttpStatus.SC_OK instead of
literal 200
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch consistency-fixes
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
commit fbf0845f4cddbfc8e5c1b2400f8991a43097a038
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed Dec 25 16:40:24 2019 +0100
Use HttpStatus.SC_OK instead of literal 200
---
.../org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java | 3 ++-
.../org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
index 0adb248..36cb7e4 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
@@ -44,6 +44,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.LengthRequiredException;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.Http1Config;
@@ -229,7 +230,7 @@ public class ClientHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
@Override
void updateInputMetrics(final HttpResponse response, final BasicHttpConnectionMetrics connMetrics) {
- if (response.getCode() >= 200) {
+ if (response.getCode() >= HttpStatus.SC_OK) {
connMetrics.incrementRequestCount();
}
}
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
index 68e3cf7..e1047ff 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
@@ -44,6 +44,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.BasicHttpConnectionMetrics;
@@ -241,7 +242,7 @@ public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
@Override
void updateOutputMetrics(final HttpResponse response, final BasicHttpConnectionMetrics connMetrics) {
- if (response.getCode() >= 200) {
+ if (response.getCode() >= HttpStatus.SC_OK) {
connMetrics.incrementRequestCount();
}
}