Skip to content

Commit 7055c19

Browse files
committed
rewrite code that reads request body
1 parent 4b304d9 commit 7055c19

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/kotlin/io/firetail/logging/servlet/FiretailMapper.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ class FiretailMapper {
2222
.mapIndexed { _, value -> value to listOf(request.getHeader(value)) }
2323
.toMap()
2424

25+
val body = request.inputStream.bufferedReader().use { it.readText() }
2526
return FtRequest(
2627
httpProtocol = request.protocol,
2728
method = request.method,
2829
headers = headers,
29-
body = request.inputStream.read().toString(),
30+
body = body,
3031
ip = request.remoteAddr,
3132
resource = request.requestURI,
3233
uri = request.requestURL.toString(), // FT calls the defines the URI as URL.

src/main/kotlin/io/firetail/logging/servlet/SpringResponseWrapper.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import java.io.PrintWriter
99
import java.util.function.Consumer
1010
import org.springframework.web.util.ContentCachingResponseWrapper
1111

12-
class SpringResponseWrapper(response: HttpServletResponse?) : ContentCachingResponseWrapper(response) {
12+
class SpringResponseWrapper(response: HttpServletResponse) : ContentCachingResponseWrapper(response) {
1313

1414
val allHeaders: Map<String, String>
1515
get() {

0 commit comments

Comments
 (0)