如何在cfhttp中指定自定义mime类型?

Dar*_*ren 1 xml coldfusion

我正在使用API​​,XML mime类型需要是application/atom + xml.ColdFusion使用的XML类型不是我需要的,我正在使用的API因为它而返回错误.有没有人设置自定义mime类型?我不想每次都去制作临时文件并在那里设置类型.

ora*_*ips 5

假设您尝试从ColdFusion提供XML,请使用cfcontent标记:

<!--- what ever algorithm you need to generate the XML to serve --->
<cfcontent reset="true" type="application/atom+xml">
<cfoutput>#xmlValue#</cfoutput>
Run Code Online (Sandbox Code Playgroud)

"reset"属性告诉ColdFusion取消先前为输出缓冲的任何内容.


Sea*_*yne 5

<cfhttp url="...">
<cfhttpparam type="header" name="Content-Type" value="application/atom+xml" />
</cfhttp>
Run Code Online (Sandbox Code Playgroud)