tracker issue : CF-4205407

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

CFHTTP method "GET" strips body

| View in Tracker

Status/Resolution/Reason: To Track//PRNeedInfo

Reporter/Name(from Bugbase): Ben F. / ()

Created: 10/11/2019

Components: Net Protocols, HTTP

Versions: 2018

Failure Type:

Found In Build/Fixed In Build: 2018.0.05.315699 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 0

Problem Description:
When you execute a GET request with CFHTTP and add a body with CFHTTPPARAM, the body gets stripped and is not send with the get request.

Steps to Reproduce:
I have added a .cfm file which demonstrates the problem. I use https://httpbin.org to check what data is send by cfhttp.
If you use cURL to send a GET request to httpbi.org you can see that the data send is returned.

Actual Result:
The cfhttp strips the cfhttpparam body parameter

Expected Result:
The cfhttp leaves the cfhttpparam body parameter and sends it with the request

Any Workarounds:
None.

Attachments:

Comments:

Hi, Could you please let me know the scenario in which you are willing to have the body to be sent along with the GET request Thank You
Comment by Megha B.
31891 | November 27, 2019 05:24:33 AM GMT
Hello Mehga, We are using elastic search. They are offering a restful api. With restful apis you use the HTTP GET command to get data from a service, and the HTTP POST command to change data on a service. With th eapi from elastic you send get requests to search the index, and then attach a body with the search parameters. Here is a CURL example: curl -XGET "http://local.containerhost:9244/exercise_questions_dev/_search" -H 'Content-Type: application/json' -d'{"sort": [{"timestamp": {"order": "asc"}}],"from": 0,"query": {"range": {"timestamp": {"gte": 1574680976097}}},"size": 20}' I know they support GET and POST requests on the _search api. To accommodate for users who cannot send a body with a GET request. We would like to use the rest api semantically correct, so we want to use the http get, with body content. [quote] A GET Request with a Body? The HTTP libraries of certain languages (notably JavaScript) don’t allow GET requests to have a request body. In fact, some users are suprised that GET requests are ever allowed to have a body. The truth is that RFC 7231 (http://tools.ietf.org/html/rfc7231#page-24) —the RFC that deals with HTTP semantics and content—does not define what should happen to a GET request with a body! As a result, some HTTP servers allow it, and some—especially caching proxies—don’t. The authors of Elasticsearch prefer using GET for a search request because they feel that it describes the action—retrieving information—better than the POST verb. However, because GET with a request body is not universally supported, the search API also accepts POST requests: [/quote]
Comment by Ben F.
32052 | December 18, 2019 02:01:39 PM GMT