【发布时间】:2015-04-01 14:43:48
【问题描述】:
我正在尝试使用 camel-http 通过 Apache Camel 发送 http 调用。
当我设置标头 Content-Type 时,它会忽略标头并且不将其包含在调用中。
我已经尝试设置标题如下:
exchange.getOut().setHeader('Content-Type', 'application/json'),
和
exchange.getOut().setHeader(Exchange.CONTENT_TYPE, 'application/json');
我也尝试过使用 camel-http 和 camel-http4,但它们都不适用。
由于我必须强制发送 Content-Type 标头,我如何强制 Camel-HTTP 包含它?
注意:我还将其他标头设置为与调用正确发送的相同方式,只是 Content-Type 不起作用
【问题讨论】:
-
你看过这个讨论吗? camel.465427.n5.nabble.com/…
-
作为一种解决方法,将正文设置为空 json 文档
{},camel-http 自动检测内容类型为 application/json 并设置正确的 Content-Type 标头。
标签: json http-headers apache-camel