Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save servilla/1de2dcefc4bd45778c5241acdeab7355 to your computer and use it in GitHub Desktop.
Save servilla/1de2dcefc4bd45778c5241acdeab7355 to your computer and use it in GitHub Desktop.
Return the request body unmodified from a Java Servlet
String req = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
logger.error(req);
response.getWriter().write(req);
response.setContentType("text/plain");
response.setStatus(HttpServletResponse.SC_OK);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment