Skip to content

Comments

[Core] - Content header writer refactor ,add content header test, and remove mediaTypeWriters#1868

Draft
yisraelU wants to merge 5 commits intodisneystreaming:series/0.18from
yisraelU:ContentHeaderTesting
Draft

[Core] - Content header writer refactor ,add content header test, and remove mediaTypeWriters#1868
yisraelU wants to merge 5 commits intodisneystreaming:series/0.18from
yisraelU:ContentHeaderTesting

Conversation

@yisraelU
Copy link
Contributor

@yisraelU yisraelU commented Jan 9, 2026

This PR changes how the content-type header is added to an outbound request in the Client codecs.

Currently , the mediaTypeWriters is invoked only when the MetadataEncoders are set .
The default for the UnaryClientCodecs is to have the Metadata Encoders set to None . ( I assume this is because some protocols dont have metadata ) . I observed when creating a test for the Content-Type header , if I did not set the metadata encoder a content type header would not be added . This is a hidden dependency and is incorrect behavior . The source for this logic is here , where if the metadata encoders field is None , we just return the mediaTypeWriters , which does not know how to decompose a schema and partition out the body part

The logic for setting content-type header is ,

  • there must be content i.e. it should not be set if the body is empty
  • if rawStringsAndBlobs is set and no mediaType is set , content-type is set according to the default media-type , otherwise use the mediaType value
  • default to the protocol configured by the requestedMediaType setting

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • Updated changelog

@yisraelU yisraelU changed the title add content header test, and remove mediaTypeWriters [Core] - Content header writer refactor ,add content header test, and remove mediaTypeWriters Jan 9, 2026
Copy link
Contributor

@lewisjkl lewisjkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, just clarifying question on the one test

Comment on lines 84 to 85
// Note: The builder chain doesn't properly override requestMediaType, so it uses the default "text/plain"
// In production (http4s), the codec is configured directly with the desired requestMediaType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand what is meant by this, can you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies , this is leftover comments from a completely different attempt at solving the underlying issue

@yisraelU yisraelU marked this pull request as draft January 13, 2026 15:56
@yisraelU
Copy link
Contributor Author

setting back to draft as I need to clarify some additional points

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.

2 participants