-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flip the default should throw behavior for HttpJsonMessageWithFaultingPayload #1176
Flip the default should throw behavior for HttpJsonMessageWithFaultingPayload #1176
Conversation
5c3cb8a
to
1e1847d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1176 +/- ##
============================================
- Coverage 80.95% 80.87% -0.08%
+ Complexity 2996 2995 -1
============================================
Files 407 407
Lines 15231 15237 +6
Branches 1023 1023
============================================
- Hits 12330 12323 -7
- Misses 2272 2286 +14
+ Partials 629 628 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
// ContentType not text if specified and has a value with / and that value does not start with text/ | ||
return Optional.ofNullable(capturedHttpJsonMessage.headers().insensitiveGet(HttpHeaderNames.CONTENT_TYPE.toString())) | ||
.map(s -> s.stream() | ||
.filter(v -> v.contains("/")) | ||
.filter(v -> !v.startsWith("text/")) | ||
.filter(cnotentTypeFilter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix spelling
@@ -93,7 +95,9 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception | |||
} | |||
} | |||
} catch (JacksonException e) { | |||
log.atInfo().setCause(e).setMessage("Error parsing json body. " + | |||
log.atLevel(hasRequestContentTypeMatching(capturedHttpJsonMessage, v -> v.startsWith("application/json")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment in the code on why we're doing this could be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the spelling issue and this change looks good
9c69dd8
to
df0d5fc
Compare
…gPayload to opt-in rather than opt-out. HttpJsonMessageWithFaultingPayload throws by default - so it could be run even if it wasn't within a transform - like from within a LoggingHandler, which is what I was observing when I added some more logging. The worst part was that it created other errors which then caused the message to be processed in a very different way. Signed-off-by: Greg Schohn <[email protected]>
df0d5fc
to
09377de
Compare
Flip the default should throw behavior for HttpJsonMessageWithFaultingPayload to opt-in rather than opt-out.
HttpJsonMessageWithFaultingPayload throws by default - so it could be run even if it wasn't within a transform - like from within a LoggingHandler, which is what I was observing when I added some more logging. The worst part was that it created other errors which then caused the message to be processed in a very different way.
Description
Issues Resolved
https://opensearch.atlassian.net/browse/MIGRATIONS-2242
Testing
gradle/cicd
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.