coldfusionhttp-headerscfhttp

View Raw HTML of CFHTTP call


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.


Solution

  • 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()#">