Skip to content

Commit 330d3ae

Browse files
committed
Handle method not allowed
1 parent 43b6d99 commit 330d3ae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/eu/openanalytics/containerproxy/ui/ErrorController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public String handleError(ModelMap map, HttpServletRequest request, HttpServletR
9191
} else if (statusCode == HttpStatus.FORBIDDEN.value()) {
9292
shortError = "Forbidden";
9393
description = "You do not have access to this page";
94+
} else if (statusCode == HttpStatus.METHOD_NOT_ALLOWED.value()) {
95+
shortError = "Method not allowed";
9496
}
9597
}
9698

@@ -121,8 +123,10 @@ public ResponseEntity<ApiResponse<Object>> error(HttpServletRequest request, Htt
121123
return ApiResponse.failNotFound();
122124
} else if (statusCode == HttpStatus.FORBIDDEN.value()) {
123125
return ApiResponse.failForbidden();
126+
} else if (statusCode == HttpStatus.METHOD_NOT_ALLOWED.value()) {
127+
return ResponseEntity.status(HttpStatus.METHOD_FAILURE).body(new ApiResponse<>("fail", "method not allowed"));
124128
}
125-
}
129+
}
126130

127131
return ApiResponse.error("unrecoverable error");
128132
}

0 commit comments

Comments
 (0)