coldfusion - 获取通过 cfhttp post 发送的内容

标签 coldfusion cfhttp

我有一个 cfc,它使用 cfhttp 调用远程服务。该服务返回一个失败代码,这意味着我对远程服务的调用格式不正确。有什么方法可以捕获我发送的 cfhttp 帖子的内容吗?我想捕获原始帖子数据,这样我就可以看到我的格式问题出在哪里。这是我的代码的示例:

<cfhttp url="https://www.webservice.com" method="POST" result="httpResponse">
  <cfhttpparam type="formField" name="method" value="doSomething">
  <cfhttpparam type="formField" name="user" value="myUserName">
  <cfhttpparam type="formField" name="password" value="myPassword">
</cfhttp>

我想做这样的事情:

<cfset result = structNew() />
<cfset result["response"] = httpResponse />
<cfset result["sentContent"] = cfhttp.sentContent />

是否可以在不查看服务器日志的情况下获取发送的 cfhttp 的内容。我的服务器不在现场,获取日志将是一个 PITA。

最佳答案

您可以创建一个要发布到的模板。该模板可以返回 GetHttpRequestData() 的结果功能。

关于coldfusion - 获取通过 cfhttp post 发送的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11739140/

相关文章:

ssl - 启用 ColdFusion 沙箱安全时,将 CFHTTP 用于安全站点失败

coldfusion - 将 SoapUI 请求转换为 CFHTTP

coldfusion - Cfhttp 结果结构在 CF8 中的行为就像 null 一样?

mysql - CFWheels:在 WHERE 子句中使用 SQL 函数?

sql - 不明确的列名错误 : SQL count, join, group by

mysql - 查询输出中缺少日期

coldfusion - CFHTTP 和 CloudFlare API : DELETE purge_everything not working

mysql - 是否使用 Blob (mysql + coldfusion)

mysql - 如何使用 Coldfusion 格式化整数?

coldfusion - 使用 cfhttp 的 addParam 方法向 HTTP 请求添加 header