如何对 HTTP POST 的 "Body" 进行 CFDUMP

How to CFDUMP the "Body" of an HTTP POST

这是我今天的问题。假设我在一页上有这个:

start.cfm

<cfset body = { "stuff": [ 1,2,3,4,5 ] }>

<cfhttp url="end.cfm" method="post" result="httpResp" timeout="60">
    <cfhttpparam type="header" name="Content-Type" value="application/json">
    <cfhttpparam type="body" value="#serializeJSON(body)#">
</cfhttp>

我不知道 end.cfm 需要什么才能输出正文中的内容。我试图 cfdump 从变量到表单再到 cgi 的所有内容,但我做不到。我错过了什么?

这样一个愚蠢的问题,我可以通过一些额外的谷歌搜索来回答它。

 <cfdump var="#GetHttpRequestData()#">

"start and end page to see what's in the request" 解决方案的替代方法是使用 Hyper:

https://www.forgebox.io/view/hyper

它包装了 cfhttp,但这样做的方式允许您重复使用请求中与对相同端点的其他调用共享的元素。与 Wirebox 和 Coldbox 配对时特别有用,但这些不是必需的。