tracker issue : CF-3537036

select a category, or use search below
(searches all categories and all time range)
Title:

cfhttp / cfhttpparam formfield elements are ignored if the cfhttp method is not GET or POST

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Chris Herdt / Chris Herdt (Chris Herdt)

Created: 04/05/2013

Components: Net Protocols

Versions: 9.0.1

Failure Type: Non Functioning

Found In Build/Fixed In Build: 9.0.1 / CF10_Update14

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Win 2008 Server R2 64 bit

Vote Count: 1

Problem Description:
Although the documentation for cfhttpparam states that "The formField type attribute is only meaningful with the cfhttp tag POST and GET methods." However, RESTful APIs may require form fields with other methods, such as DELETE and PUT. Other HTTP tools, such as cURL and Java's HttpURLConnection class, do send form fields with other request methods when specified.

The specific example I am looking at is Instructure's Canvas API, e.g. https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.update

Steps to Reproduce:
<cfhttp url="#uri#" result="result" method="PUT">
  <cfhttpparam type="header" name="Authorization" value="Bearer #accessToken#" />
  <cfhttpparam type="formfield" name="name" value="SAMPLE" />
</cfhttp>

(Where uri is an API endpoint and accessToken is a valid access token.)

Actual Result:
The API request succeeds, but the data is not changed.

Expected Result:
A successful API request that changes the data.

Any Workarounds:
I have used the underlying Java classes to get around this issue, but I feel like this should work using the CF tags.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3537036

External Customer Info:
External Company:  
External Customer Name: cherdt
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

ColdFusion forum post regarding this issue here: http://forums.adobe.com/message/5204923
Comment by External U.
15783 | April 05, 2013 06:14:11 PM GMT
Yeah, this is pretty significant in the context of REST APIs, which are big feature in CF10... -- Adam
Vote by External U.
15787 | April 05, 2013 08:27:26 PM GMT
Has this bug been patched in CF10? I am still experiencing it on this server (albeit with a lower build number). Server Product ColdFusion Version 10,0,12,286680 Tomcat Version 7.0.23.0 Edition Standard Operating System UNIX OS Version 3.2.0-63-generic Update Level /opt/coldfusion10/cfusion/lib/updates/chf10000012.jar Adobe Driver Version 4.1 (Build 0001)
Comment by External U.
15784 | June 01, 2014 12:07:35 PM GMT
No. This will be included in the next CF 10 update.
Comment by Rupesh K.
15785 | June 02, 2014 03:17:22 AM GMT
1. Note: we are on CF 10 update 15 still experiencing the following: You cannot mix the use of cfhttpparam tags of type file or formfield with cfhttpparam tags of type body or XML. 2.400 Bad Request <cfhttp method="put" url="#destURL#" result="httpCrtResp" timeout="600"> <cfhttpparam type="header" name="Authorization" value="Bearer #access_token#" /> <cfhttpparam type="header" name="accept" value="application/json" /> <cfhttpparam type="header" name="Content-Type" value="multipart/form-data" /> <cfhttpparam type="formfield" name="listname" value="#listname#" /> <cfhttpparam type="formfield" name="headings" value="Y" /> <cfhttpparam type="formfield" name="fieldseparator" value="COMMA" /> <cfhttpparam type="formfield" name="quotecharacter" value="DOUBLE_QUOTE" /> <cfhttpparam type="formfield" name="uploadspecs" value="#restHdr#" /> <cfhttpparam type="formfield" name="mergespecs" value="#mergespecs#" /> <cfhttpparam type="file" name="file" file="#csvZipFile#" mimetype="application/zip" /> <!---cfhttpparam type="file" name="file" file="#csvfileName#" mimetype="application/vnd.ms-excel"---> <!---cfhttpparam type="file" name="file" file="#csvfileName#" mimetype="application/csv"---> </cfhttp> 3. 500 Internal Server Error - multipart="yes" <cfhttp method="put" url="#destURL#" result="httpCrtResp" multipart="yes" timeout="600"> <cfhttpparam type="header" name="Authorization" value="Bearer #access_token#" /> <cfhttpparam type="header" name="accept" value="application/json" /> <cfhttpparam type="header" name="Content-Type" value="multipart/form-data" /> <cfhttpparam type="formfield" name="listname" value="#listname#" /> <cfhttpparam type="formfield" name="headings" value="Y" /> <cfhttpparam type="formfield" name="fieldseparator" value="COMMA" /> <cfhttpparam type="formfield" name="quotecharacter" value="DOUBLE_QUOTE" /> <cfhttpparam type="formfield" name="uploadspecs" value="#restHdr#" /> <cfhttpparam type="formfield" name="mergespecs" value="#mergespecs#" /> <!--- cfhttpparam type="file" name="file" file="#csvZipFile#" mimetype="application/zip" /---> <cfhttpparam type="file" name="file" file="#csvfileName#" mimetype="application/vnd.ms-excel"> <!---cfhttpparam type="file" name="file" file="#csvfileName#" mimetype="application/csv"---> </cfhttp> 4. 500 Internal Server Error - commented out content-type in header <cfhttp method="put" url="#destURL#" result="httpCrtResp" multipart="yes" timeout="600"> <cfhttpparam type="header" name="Authorization" value="Bearer #access_token#" /> <cfhttpparam type="header" name="accept" value="application/json" /> <!---cfhttpparam type="header" name="Content-Type" value="multipart/form-data" /---> <cfhttpparam type="formfield" name="listname" value="#listname#" /> <cfhttpparam type="formfield" name="headings" value="Y" /> <cfhttpparam type="formfield" name="fieldseparator" value="COMMA" /> <cfhttpparam type="formfield" name="quotecharacter" value="DOUBLE_QUOTE" /> <cfhttpparam type="formfield" name="uploadspecs" value="#restHdr#" /> <cfhttpparam type="formfield" name="mergespecs" value="#mergespecs#" /> <!--- cfhttpparam type="file" name="file" file="#csvZipFile#" mimetype="application/zip" /---> <cfhttpparam type="file" name="file" file="#csvfileName#" mimetype="application/vnd.ms-excel"> <!---cfhttpparam type="file" name="file" file="#csvfileName#" mimetype="application/csv"---> </cfhttp>
Comment by External U.
15786 | March 16, 2015 07:40:10 AM GMT