corrected BaseJettyTest: by HTML spec, HEAD requests shouldnt get any body in response

This commit is contained in:
Alex Yarmula 2010-03-26 12:15:17 -07:00
parent 13da9016e0
commit 9b510a9efe
1 changed files with 11 additions and 1 deletions

View File

@ -170,7 +170,7 @@ public abstract class BaseJettyTest {
if (failIfNoContentLength(request, response)) {
return;
} else if (target.indexOf("redirect") > 0) {
response.sendRedirect("http://localhost:" + (testPort + 1));
response.sendRedirect("http://localhost:" + (testPort + 1) + "/");
} else if (target.indexOf("101constitutions") > 0) {
response.setContentType("text/plain");
response.setHeader("Content-MD5", md5);
@ -213,6 +213,11 @@ public abstract class BaseJettyTest {
response.setContentType("text/plain");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("test");
} else if (request.getMethod().equals("HEAD")) {
/* NOTE: by HTML specification, HEAD response MUST NOT
include a body */
response.setContentType("text/xml");
response.setStatus(HttpServletResponse.SC_OK);
} else {
if (failEveryTenRequests(request, response))
return;
@ -257,6 +262,11 @@ public abstract class BaseJettyTest {
} else {
handleAction(request, response);
}
} else if (request.getMethod().equals("HEAD")) {
/* NOTE: by HTML specification, HEAD response MUST NOT
include a body */
response.setContentType("text/xml");
response.setStatus(HttpServletResponse.SC_OK);
} else {
response.setContentType("text/xml");
response.setStatus(HttpServletResponse.SC_OK);