You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2016/12/22 07:56:58 UTC

[jira] [Commented] (CAMEL-10633) json dataformat should set a header "Content-Type: application/json" if there's no "Content-Type" header set

    [ https://issues.apache.org/jira/browse/CAMEL-10633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15769407#comment-15769407 ] 

Claus Ibsen commented on CAMEL-10633:
-------------------------------------

I think we should add an option to configure whether to set content-type header or not. And turn this on by default.
Then it always set the correct content-type header.

for example you mave consume from XML -> pojo -> json and then because there is maybe an existing content-type=application/xml header then it would still be this header and therefore wrong when the content is now json.

And with this new option people can turn it off if they want the old behavior of no header at all.

We can look into doing this for more of the data formats, there are others for xml, yaml etc.

> json dataformat should set a header "Content-Type: application/json" if there's no "Content-Type" header set
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-10633
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10633
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: james strachan
>             Fix For: 2.19.0
>
>
> if you marshal to json then send to a HTTP endpoint you'll be missing the fact that the payload is now in JSON format. It seems a reasonable default to add this - so that a HTTP endpoint can know it can parse the payload as JSON.
> e.g.
> {code}
> from("activemq:foo.bar").
>   to("dataformat:json-jackson:marshal").
>     /// TODO camel should now expose that the content type is json
>   to("http://foo.bar/")
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)