I can't get query params inside ColdFusion component.
I tried to use:
<cfparam name="url.q2" default="">
cgi.QUERY_STRING
arguments
All empty
I have a component:
<cfcomponent extends="taffy.core.resource" taffy:uri="/public/test" hint="some hint about this resource">
<cffunction name="get" access="public" output="false">
<cfparam name="url.query_p1" default="">
<cfparam name="url.p2" default="">
<cfset result = structNew() />
<cfset result['arguments'] = arguments />
<cfset result['cgi'] = cgi />
<cfset result['QUERY_STRING'] = cgi.QUERY_STRING />
<cfset result['url'] = url />
<cfreturn representationOf(result).withStatus(200) />
</cffunction>
</cfcomponent>
And use this url for test: http://localhost/public/test?query_p=1&p2=test
As response I got:
{
"data": {},
"arguments": {
"endpoint": "/public/test/",
"type": "candidate"
},
"QUERY_STRING": "endpoint=/public/test/",
"url": {
"endpoint": "/public/test/",
"query_p1": "",
"p2": ""
},
"cgi": {
"query_string": "endpoint=/public/test/",
"request_url": "http://localhost/index.cfm?endpoint=/public/test/",
}
}
How can I get something like? :
query_p=1
p2=test
...
You want something like this:
You can see additional Taffy Examples at
https://github.com/jmohler1970/Taffy_Verbs_withCache/blob/master/resources/users/users_id.cfc
Disclaimer: This is my sample code