HADOOP-14915. method name is incorrect in ConfServlet. Contributed by Bharat Viswanadham.
This commit is contained in:
parent
06df6ab254
commit
563dcdfc1d
@ -69,7 +69,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String format = parseAccecptHeader(request);
|
String format = parseAcceptHeader(request);
|
||||||
if (FORMAT_XML.equals(format)) {
|
if (FORMAT_XML.equals(format)) {
|
||||||
response.setContentType("text/xml; charset=utf-8");
|
response.setContentType("text/xml; charset=utf-8");
|
||||||
} else if (FORMAT_JSON.equals(format)) {
|
} else if (FORMAT_JSON.equals(format)) {
|
||||||
@ -89,7 +89,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static String parseAccecptHeader(HttpServletRequest request) {
|
static String parseAcceptHeader(HttpServletRequest request) {
|
||||||
String format = request.getHeader(HttpHeaders.ACCEPT);
|
String format = request.getHeader(HttpHeaders.ACCEPT);
|
||||||
return format != null && format.contains(FORMAT_JSON) ?
|
return format != null && format.contains(FORMAT_JSON) ?
|
||||||
FORMAT_JSON : FORMAT_XML;
|
FORMAT_JSON : FORMAT_XML;
|
||||||
|
@ -98,7 +98,7 @@ public void testParseHeaders() throws Exception {
|
|||||||
Mockito.when(request.getHeader(HttpHeaders.ACCEPT))
|
Mockito.when(request.getHeader(HttpHeaders.ACCEPT))
|
||||||
.thenReturn(contentTypeExpected);
|
.thenReturn(contentTypeExpected);
|
||||||
assertEquals(contenTypeActual,
|
assertEquals(contenTypeActual,
|
||||||
ConfServlet.parseAccecptHeader(request));
|
ConfServlet.parseAcceptHeader(request));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user