Skip to content

fix: send status-notifier webhook body as UTF-8 so Content-Length matches the payload - #1424

Open
nikhiln64 wants to merge 3 commits into
conductor-oss:mainfrom
nikhiln64:fix/status-notifier-utf8-entity
Open

fix: send status-notifier webhook body as UTF-8 so Content-Length matches the payload#1424
nikhiln64 wants to merge 3 commits into
conductor-oss:mainfrom
nikhiln64:fix/status-notifier-utf8-entity

Conversation

@nikhiln64

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

status-notifier webhook sends wrong Content-Length for non-ASCII output (StringEntity defaults to ISO-8859-1)

1 participant