feat: default datacontenttype to application/json - #14
Merged
Merged
Conversation
Greptile SummaryThe PR changes the constructor’s default
Confidence Score: 5/5This PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "feat: default datacontenttype to applica..." | Re-trigger Greptile |
Meldiron
force-pushed
the
feat-datacontenttype-default
branch
from
July 30, 2026 11:06
1cdafe1 to
fbff67c
Compare
Meldiron
force-pushed
the
docs-spec-accuracy
branch
from
July 31, 2026 10:00
eb1675c to
aed7a6b
Compare
Meldiron
force-pushed
the
feat-datacontenttype-default
branch
from
July 31, 2026 10:03
fbff67c to
00eb1c9
Compare
The constructor now defaults datacontenttype to "application/json", the overwhelmingly common case, instead of leaving it unset. The parameter stays nullable so callers can pass null to leave the attribute unset. fromArray() deliberately keeps preserving the wire form: an absent datacontenttype stays absent, since the JSON format already treats an absent datacontenttype as implying a JSON payload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Meldiron
force-pushed
the
feat-datacontenttype-default
branch
from
July 31, 2026 10:10
00eb1c9 to
8168ffd
Compare
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.
What
The constructor now defaults
datacontenttypetoapplication/jsoninstead of leaving it unset. The parameter stays nullable, sodatacontenttype: nullstill leaves the attribute unset (and omitted fromtoArray()).Why
JSON payloads are the overwhelmingly common case, and every caller was spelling out
datacontenttype: 'application/json'by hand.Notes
fromArray()deliberately keeps preserving the wire form — an absentdatacontenttypestays absent on the parsed event (guarded by the existingtestFromArrayDoesNotFabricateDatacontenttype). Per the JSON format spec, an absentdatacontenttypealready implies a JSON payload, so nothing needs to be fabricated when parsing.toArray()on a default-constructed event now includes'datacontenttype' => 'application/json', which is a behavior change for producers relying on the attribute being omitted.🤖 Generated with Claude Code