File tree Expand file tree Collapse file tree
src/main/java/com/retailsvc/http Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import static java .net .HttpURLConnection .HTTP_BAD_REQUEST ;
55import static java .net .HttpURLConnection .HTTP_INTERNAL_ERROR ;
66import static java .net .HttpURLConnection .HTTP_NOT_FOUND ;
7+ import static java .net .HttpURLConnection .HTTP_NO_CONTENT ;
78import static java .nio .charset .StandardCharsets .UTF_8 ;
89
910import com .retailsvc .http .internal .ClasspathResourceHandler ;
@@ -61,7 +62,7 @@ public static HttpHandler aliveHandler() {
6162 return new MethodLimitedHandler (
6263 exchange -> {
6364 try (exchange ) {
64- exchange .sendResponseHeaders (204 , -1 );
65+ exchange .sendResponseHeaders (HTTP_NO_CONTENT , -1 );
6566 }
6667 });
6768 }
Original file line number Diff line number Diff line change 11package com .retailsvc .http .internal ;
22
3+ import static java .net .HttpURLConnection .HTTP_OK ;
4+
35import com .sun .net .httpserver .HttpExchange ;
46import com .sun .net .httpserver .HttpHandler ;
57import java .io .IOException ;
@@ -34,10 +36,10 @@ public void handle(HttpExchange exchange) throws IOException {
3436 exchange .getResponseHeaders ().add ("Content-Type" , contentType );
3537 if ("HEAD" .equals (exchange .getRequestMethod ())) {
3638 exchange .getResponseHeaders ().add ("Content-Length" , String .valueOf (bytes .length ));
37- exchange .sendResponseHeaders (200 , -1 );
39+ exchange .sendResponseHeaders (HTTP_OK , -1 );
3840 return ;
3941 }
40- exchange .sendResponseHeaders (200 , bytes .length );
42+ exchange .sendResponseHeaders (HTTP_OK , bytes .length );
4143 exchange .getResponseBody ().write (bytes );
4244 }
4345 }
You can’t perform that action at this time.
0 commit comments