fix: send status-notifier webhook body as UTF-8 so Content-Length matches the payload - #1424
Open
nikhiln64 wants to merge 3 commits into
Open
fix: send status-notifier webhook body as UTF-8 so Content-Length matches the payload#1424nikhiln64 wants to merge 3 commits into
nikhiln64 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1399.
RestClientManager built the webhook entity with the single argument StringEntity constructor, which on the pinned httpclient 4.5.x encodes the body as ISO-8859-1. As soon as the workflow or task summary contains a multibyte character such as an en dash or a non breaking space, the declared Content-Length no longer matches the UTF-8 payload and strict receivers reject the POST. The retry path fails the same way, so the notification is lost.
The entity is now built with ContentType.APPLICATION_JSON, which encodes the body as UTF-8 and declares the charset in the Content-Type header. The manual Content-type header is removed since the entity now carries it.
Testing
Added RestClientManagerTest covering a payload with an en dash: the entity's Content-Length must equal the UTF-8 byte length, the body bytes must round trip as UTF-8, and the declared content type must carry the UTF-8 charset. createPostRequest was widened to package visibility with @VisibleForTesting for this. Module suite passes with ./gradlew :conductor-task-status-listener:test.