Skip to content

fix(status-notifier): use UTF-8 charset in webhook POST body - #1473

Open
shaileshpadave wants to merge 2 commits into
mainfrom
fix/issue-1399-content-type-utf8
Open

fix(status-notifier): use UTF-8 charset in webhook POST body#1473
shaileshpadave wants to merge 2 commits into
mainfrom
fix/issue-1399-content-type-utf8

Conversation

@shaileshpadave

Copy link
Copy Markdown
Contributor

What

StringEntity(data) defaults to ISO-8859-1 on httpclient 4.5.x. This causes Content-Length to be computed from the ISO-8859-1 byte count, which disagrees with the actual UTF-8 body length whenever the payload contains a non-ASCII character (e.g. en dash , non-breaking space). Strict HTTP receivers reject these POSTs.

Fix: pass ContentType.APPLICATION_JSON (UTF-8) to StringEntity.

Fixes #1399

How to verify

  1. Configure status-notifier with a webhook receiver that validates Content-Length:
    conductor.workflow-status-listener.type=workflow_publisher
    conductor.status-notifier.notification.url=http://<receiver>
    conductor.status-notifier.notification.endpointWorkflow=events/workflow
    conductor.status-notifier.notification.subscribedWorkflowStatuses=COMPLETED
    
  2. Run a workflow whose output contains a non-ASCII character, e.g. {"note": "in–network"} (en dash U+2013).
  3. Before fix: receiver rejects with Content-Length mismatch. After fix: notification delivers successfully.

…-Length mismatch

StringEntity(data) defaults to ISO-8859-1 on httpclient 4.5.x, causing the
Content-Length to disagree with the actual UTF-8 body length for non-ASCII
characters. Passing ContentType.APPLICATION_JSON ensures both the body bytes
and Content-Length are computed as UTF-8.

Fixes #1399
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)

2 participants