我有一个 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/