Skip to content

fix: send structured cloudevents json from HTTP sink - #55

Open
dillon-zheng wants to merge 2 commits into
jenkinsci:mainfrom
dillon-zheng:codex/fix-http-sink-json
Open

fix: send structured cloudevents json from HTTP sink#55
dillon-zheng wants to merge 2 commits into
jenkinsci:mainfrom
dillon-zheng:codex/fix-http-sink-json

Conversation

@dillon-zheng

Copy link
Copy Markdown

Summary

  • serialize outgoing CloudEvents with the SDK event format instead of event.toString()
  • send structured JSON payloads with the matching Content-Type
  • add coverage for the HTTP sink payload/body format

Problem

The current HTTP sink posts the Java object string form like:

CloudEvent{id='...', source=..., type='...', ...}

That payload is not a standard CloudEvents wire format and forces downstream receivers to add fragile custom parsing.

Fix

Use the CloudEvents SDK event format provider to serialize the event into structured JSON before sending the HTTP request.

Testing

  • mvn -Dtest=HttpSinkTest test
  • mvn -DskipTests package
  • local Jenkins Docker validation with the built cdevents.hpi and an HTTP receiver capturing the posted request body/header

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.

1 participant