Skip to content

Commit 37264b4

Browse files
author
patched.codes[bot]
committed
Patched src/main/java/io/shiftleft/controller/AppErrorController.java
1 parent 207ff48 commit 37264b4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/io/shiftleft/controller/AppErrorController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.springframework.http.ResponseEntity;
77
import org.springframework.stereotype.Controller;
88
import org.springframework.web.bind.annotation.RequestMapping;
9+
import org.springframework.web.bind.annotation.RequestMethod;
910
import org.springframework.web.bind.annotation.ResponseBody;
1011
import org.springframework.web.context.request.RequestAttributes;
1112
import org.springframework.web.context.request.ServletRequestAttributes;
@@ -18,7 +19,7 @@
1819
* Error controller, based on https://stackoverflow.com/questions/31134333/this-application-has-no-explicit-mapping-for-error/31838439#31838439
1920
*/
2021
@Controller
21-
public class AppErrorController implements ErrorController{
22+
public class AppErrorController implements ErrorController {
2223

2324
/**
2425
* Error Attributes in the Application
@@ -40,7 +41,7 @@ public AppErrorController(ErrorAttributes errorAttributes) {
4041
* @param request
4142
* @return
4243
*/
43-
@RequestMapping(value = ERROR_PATH, produces = "text/html")
44+
@RequestMapping(value = ERROR_PATH, produces = "text/html", method = RequestMethod.GET)
4445
public ModelAndView errorHtml(HttpServletRequest request) {
4546
return new ModelAndView("/errors/error", getErrorAttributes(request, false));
4647
}
@@ -50,7 +51,7 @@ public ModelAndView errorHtml(HttpServletRequest request) {
5051
* @param request
5152
* @return
5253
*/
53-
@RequestMapping(value = ERROR_PATH)
54+
@RequestMapping(value = ERROR_PATH, method = RequestMethod.GET)
5455
@ResponseBody
5556
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
5657
Map<String, Object> body = getErrorAttributes(request, getTraceParameter(request));
@@ -68,7 +69,6 @@ public String getErrorPath() {
6869
return ERROR_PATH;
6970
}
7071

71-
7272
private boolean getTraceParameter(HttpServletRequest request) {
7373
String parameter = request.getParameter("trace");
7474
if (parameter == null) {
@@ -102,4 +102,4 @@ private HttpStatus getStatus(HttpServletRequest request) {
102102
}
103103
return HttpStatus.INTERNAL_SERVER_ERROR;
104104
}
105-
}
105+
}

0 commit comments

Comments
 (0)