View Raw HTML of CFHTTP call

早过忘川 提交于 2020-01-03 16:52:41

问题


Is there a way to output the raw html of a CFHTTP call? I am trying to see how some of the header authentication information is coming across.

I am open to browser plugins or code updates whichever helps me see what is going on during the cfhttp call.

So for example:

<cfhttp method="get" url="https://test-ows01.mywebsite.com/criminal_api//1.0/service/requests" result="orderList">
    <cfhttpparam type="HEADER" name="Authorization" value="Basic #ToBase64("bearer:4EC8B09D3F911764B1DCD3EFA38DFB31")#">
</cfhttp>

what does the above call look like when it happens.


回答1:


If I am understanding correctly, it sounds more like you want to view the http request sent to the remote server, rather than what is received. Installing a tool like Fiddler will provide very robust debugging, allowing you to view http requests as they happen. (See also the documentation for Enable HTTPS traffic decryption).

Tip for quick debugging, a low-tech hack is to switch the target URL to a separate .cfm script on your server. Inside the script, dump GetHTTPRequestData(), to display the request headers and body sent to the script.

test.cfm

<cfhttp method="get" url="http://localhost/receivingPage.cfm" result="orderList">
    <cfhttpparam type="HEADER" name="Authorization" 
         value="Basic #ToBase64("bearer:4EC8B09D3F911764B1DCD3EFA38DFB31")#">
</cfhttp>

receivingPage.cfm

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


来源:https://stackoverflow.com/questions/37011915/view-raw-html-of-cfhttp-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!