Skip to content

Commit

Permalink
Merge pull request #523 from EBISPOT/issue-497
Browse files Browse the repository at this point in the history
issue-497: add content type header before writing to output stream
  • Loading branch information
serjoshua authored Sep 26, 2023
2 parents ecd119d + b41a20b commit ceeafa6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ public void search(
responseObj.put("responseHeader", responseHeader);
responseObj.put("response", responseBody);

response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.flushBuffer();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ public void select(
}
responseObj.put("highlighting", highlighting);

response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.flushBuffer();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ public void suggest(
responseObj.put("responseHeader", responseHeader);
responseObj.put("response", responseBody);

response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.flushBuffer();
}

Expand Down

0 comments on commit ceeafa6

Please sign in to comment.