Skip to content

Commit

Permalink
#1165 - POJO conversion doesn't work on Content-Type = application/js…
Browse files Browse the repository at this point in the history
…on; charset=UTF-8
  • Loading branch information
ipolevoy committed Nov 22, 2021
1 parent 7497b01 commit 2931d6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private void executeAction(Route route) {
@SuppressWarnings("unchecked")
private Object getRequestObject(Route route) throws IllegalAccessException, InstantiationException, IOException, InvocationTargetException, NoSuchMethodException {
String contentType = RequestContext.getHttpRequest().getContentType();
boolean jsonRequest = contentType != null && contentType.equals("application/json");
boolean jsonRequest = contentType != null && contentType.toLowerCase().contains("application/json");
Map<String, String> requestMap;
if(jsonRequest){
InputStream in = route.getController().getRequestInputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void shouldInvalidateOutOfRangeValue() throws IOException, ServletExcepti
public void should_convert_JSON_to_Model() throws IOException, ServletException {
request.setServletPath("/request_argument/get_total");
request.setMethod("GET");
request.setContentType("application/json");
request.setContentType("application/json; charset=utf-8");

request.setContent("{ \"amount\" : 50, \"total\" : 30 }".getBytes());
dispatcher.doFilter(request, response, filterChain);
Expand Down

0 comments on commit 2931d6c

Please sign in to comment.