mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-11 13:48:37 +02:00
Update CorrelationIdFilterTest.java
This commit is contained in:
parent
1973c86720
commit
cf2f366e8e
@ -22,12 +22,11 @@ import jakarta.servlet.ServletResponse;
|
||||
/**
|
||||
* Tests for {@link CorrelationIdFilter}.
|
||||
*
|
||||
* <p>Important notes:
|
||||
* - The filter sets MDC in the try block and clears it in the finally block. Therefore,
|
||||
* we capture the MDC values inside a special FilterChain before the clear happens (snapshot).
|
||||
* - The response header is sanitized via Newlines.stripAll(id).
|
||||
* The current code does NOT sanitize the value stored in the MDC or the request attribute.
|
||||
* These tests reflect the current behavior.
|
||||
* <p>Important notes: - The filter sets MDC in the try block and clears it in the finally block.
|
||||
* Therefore, we capture the MDC values inside a special FilterChain before the clear happens
|
||||
* (snapshot). - The response header is sanitized via Newlines.stripAll(id). The current code does
|
||||
* NOT sanitize the value stored in the MDC or the request attribute. These tests reflect the
|
||||
* current behavior.
|
||||
*/
|
||||
class CorrelationIdFilterTest {
|
||||
|
||||
@ -133,7 +132,8 @@ class CorrelationIdFilterTest {
|
||||
|
||||
assertTrue(chain.called);
|
||||
|
||||
// Consistency: same value in MDC, request attribute, and response header (no newline removal needed)
|
||||
// Consistency: same value in MDC, request attribute, and response header (no newline
|
||||
// removal needed)
|
||||
String mdcId = chain.capturedMdc.get(CorrelationIdFilter.MDC_KEY);
|
||||
assertNotNull(mdcId);
|
||||
assertEquals(mdcId, chain.requestAttr);
|
||||
|
Loading…
Reference in New Issue
Block a user