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

发布于 2024-10-09 19:57:13 字数 149 浏览 0 评论 0原文

我正在使用 API,XML mime 类型需要是 application/atom+xml。 ColdFusion 使用的 XML 类型不是我需要的类型,因此我正在使用的 API 返回一个错误。有没有人可以设置自定义 mime 类型?我不想每次都必须创建一个临时文件并在那里设置类型。

I am working with an API and the XML mime type needs to be application/atom+xml. The XML type that ColdFusion uses is not the one I need and the API I am working with is giving back an error because of it. Is there anyone to set a custom mime type? I do not want to have to go the route of making a temporary file every time and setting the type on there.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放肆 2024-10-16 19:57:13
<cfhttp url="...">
<cfhttpparam type="header" name="Content-Type" value="application/atom+xml" />
</cfhttp>
<cfhttp url="...">
<cfhttpparam type="header" name="Content-Type" value="application/atom+xml" />
</cfhttp>
一向肩并 2024-10-16 19:57:13

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

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

“reset”属性告诉 ColdFusion 取消之前为输出缓冲的任何内容。

Assuming you're trying to serve the XML from ColdFusion use the cfcontent tag as such:

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

The "reset" attribute tells ColdFusion to cancel out anything buffered for output previously.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文