Skip to content

fix: publishEvent method to support text content types and improve serialization handling - #1831

Merged
javier-aliaga merged 1 commit into
dapr:masterfrom
matheusandre1:issue779
Oct 11, 2026
Merged

javier-aliaga merged 1 commit into
dapr:masterfrom
matheusandre1:issue779

Conversation

@matheusandre1

Copy link
Copy Markdown
Contributor

Description

Fixes content-type mismatch in publishEvent: when a text content type (text/* or application/xml) is set and the default serializer is used, String/Number/Boolean data is now sent as raw text instead of being JSON-quoted. This matches the behavior already used by publishEvents (bulk) via DefaultContentTypeConverter.

Behavior change

"hello" published with text/plain is now sent as hello instead of "hello". Subscribers that strip the extra quotes should remove that workaround. Publishing without a content type is unchanged (application/json), as are custom serializers and non-text content types.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Fixes: #779

RELEASE NOTE: FIX publishEvent no longer JSON-quotes String/Number/Boolean payloads when a text content type is set

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

…rialization handling

Signed-off-by: Matheus André <matheusandr2@gmail.com>
@matheusandre1
matheusandre1 marked this pull request as ready for review October 8, 2026 15:58
@matheusandre1
matheusandre1 requested review from a team as code owners October 8, 2026 15:58
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.74%. Comparing base (77f6794) to head (cadcf52).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1831      +/-   ##
============================================
+ Coverage     79.66%   79.74%   +0.07%     
- Complexity     2683     2689       +6     
============================================
  Files           267      267              
  Lines          7923     7928       +5     
  Branches        839      841       +2     
============================================
+ Hits           6312     6322      +10     
+ Misses         1252     1249       -3     
+ Partials        359      357       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@javier-aliaga
javier-aliaga merged commit 1722c2c into dapr:master Oct 11, 2026
16 checks passed
@matheusandre1
matheusandre1 deleted the issue779 branch October 11, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content-Type mismatch in publishEvent call

2 participants