consistent usage of Apache http status constants (#2432)

This commit is contained in:
Albin Larsson 2020-03-18 07:40:52 +01:00 committed by GitHub
parent 1bbf3df0f3
commit 9745bfe374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -50,6 +50,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -203,10 +204,10 @@ public class RefineServlet extends Butterfly {
command.doDelete(request, response);
logger.trace("< DELETE {}", commandKey);
} else {
response.sendError(405);
response.sendError(HttpStatus.SC_METHOD_NOT_ALLOWED);
}
} else {
response.sendError(404);
response.sendError(HttpStatus.SC_NOT_FOUND);
}
} else {
super.service(request, response);

View File

@ -44,6 +44,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
@ -296,7 +297,7 @@ public class RefineServletTests extends RefineTest {
}
protected void verifyError404Called(){
try {
verify(response,times(1)).sendError(404);
verify(response,times(1)).sendError(HttpStatus.SC_NOT_FOUND);
} catch (IOException e) {
Assert.fail();
}