Question

I have a cfc that makes a call to a remote service using cfhttp. The service is returning a failure code, which means that my call to the remote service is not formatted properly. Is there any way to capture the content of a cfhttp post I'm sending? I want to capture the raw post data so I can see where my formatting problem is. Here is a sample of what my code looks like:

<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>

I'd like to do something like this:

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

Is it possible to get the content of a sent cfhttp without looking at the server logs. My server is offsite and getting the logs will be a PITA.

Était-ce utile?

La solution

You could create a template to which you would POST to. That template could return the result of GetHttpRequestData() function.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top