Skip to content

Commit

Permalink
Read the request body
Browse files Browse the repository at this point in the history
Otherwise it won't be cached
  • Loading branch information
zechmeister committed Oct 31, 2024
1 parent 0a8af70 commit 68a2519
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -40,8 +41,7 @@ protected void doFilterInternal(
throws ServletException, IOException {

ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request);
String requestBody =
new String(wrappedRequest.getContentAsByteArray(), request.getCharacterEncoding());
String requestBody = wrappedRequest.getReader().lines().collect(Collectors.joining("\n"));

String hmac = request.getHeader("callback-authentication");

Expand Down

0 comments on commit 68a2519

Please sign in to comment.