feat: servlet 5.0 body capture fix#411
Conversation
|
|
||
| if (!request.isAsyncStarted()) { | ||
| if (instrumentationConfig.httpHeaders().response()) { | ||
| httpResponse.flushBuffer(); |
There was a problem hiding this comment.
The HttpServletResponse getHeaderNames() will only give headers that are set via set/add Headers functions at client side (docs), so for servlet applications where content-type is set in general with setContentType(), at this specific point if we call getHeaderNames(), it will not contain content-type, content-length etc headers as it is explicitly not set by setHeader()/addHeader() at client side. So we will not collect the content-type header and thereby dropping the body. (For context look at the simple application here)
The info which is set by setContentType(), setContentEncoding() etc are available in buffer, which will be set as headers to client at close commit normally, so calling flushbuffer() ourselves on OnMethodExit() before to get these headers populated into span.
No description provided.