Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Http4s] Content-Type conflict #969

Closed
yisraelU opened this issue May 18, 2023 · 4 comments
Closed

[Http4s] Content-Type conflict #969

yisraelU opened this issue May 18, 2023 · 4 comments

Comments

@yisraelU
Copy link
Contributor

yisraelU commented May 18, 2023

An Issue arises when there is a conflict between the media type defined in the CodecApi and a member of a struct that has a httpHeader trait setting the Content-Type on it.

  • This is a problem in the StringAndBlobSchemaVisitor which allows the MediaType to be dynamic and derived from the schema
    For example:
structure MyStructure {
    @httpHeader("Content-Type")
    contentType: String,

    @httpPayload
    data: Blob
}

This is caused by setting the content type using the EntityEncoder from http4s withContentType .

  • This is also a problem in simpleRestJson , as it causes the httpHeader trait to be ignored when using it for Content-Type
  • Aso I would add that changing the order of the arguments to combine method , would change this behavior which did take me by surprise
@kubukoz
Copy link
Member

kubukoz commented May 18, 2023

Combine was never commutative I think, if you have functions that override the same field you can't just compose them in both directions

@yisraelU
Copy link
Contributor Author

edited explanation of what surprised me

@kubukoz
Copy link
Member

kubukoz commented May 21, 2023

related: #28 #29

@yisraelU
Copy link
Contributor Author

fixed

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

No branches or pull requests

2 participants