Skip to content

Commit 3649040

Browse files
Add a new JakartaRsFeature to consume all content, on by default (#16)
See FasterXML/jackson-jaxrs-providers#108
1 parent 950dda5 commit 3649040

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

base/src/main/java/com/fasterxml/jackson/jakarta/rs/base/ProviderBase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ protected EP_CONFIG _configForReading(MAPPER mapper,
438438
} else {
439439
r = mapper.reader();
440440
}
441+
if (JakartaRSFeature.READ_FULL_STREAM.enabledIn(_jakartaRSFeatures)) {
442+
r = r.withFeatures(DeserializationFeature.FAIL_ON_TRAILING_TOKENS);
443+
}
441444
return _configForReading(r, annotations);
442445
}
443446

base/src/main/java/com/fasterxml/jackson/jakarta/rs/cfg/JakartaRSFeature.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ public enum JakartaRSFeature implements ConfigFeature
2424
*/
2525
ALLOW_EMPTY_INPUT(true),
2626

27+
/**
28+
* For HTTP keep-alive or multipart content to work correctly, Jackson must read the entire HTTP input
29+
* stream up until reading EOF (-1).
30+
* <a href="https://github.com/FasterXML/jackson-jaxrs-providers/issues/108">Issue #108</a>
31+
* If set to true, always consume all input content. This has a side-effect of failing on trailing content.
32+
*/
33+
READ_FULL_STREAM(true),
34+
2735
/*
2836
/**********************************************************************
2937
/* HTTP headers

0 commit comments

Comments
 (0)