engchun
engchun

Reputation: 11

coldfusion cfhttp GET method issue with context-type header

<cfhttp method="GET" url="https://xxxx/Authentication/CorpPassAuth?scope=abc&callback_url=https://xxxx/apiresponse.cfm" result="a">
<cfhttpparam type="header" name="Content-Type" value="application/json"></cfhttpparam>
<cfhttpparam type="header" name="X-IBM-Client-Secret" value="xxx"></cfhttpparam>
<cfhttpparam type="header" name="X-IBM-Client-Id" value="xxxx"></cfhttpparam>

I imported related-certificate into cacert. All POST method API is working fine only the GET method cannot get the expected result. The expected result should is json but the result showing me the website screen. The JAVA is 1.8.0_231-b11. The SSL cert is entrust.net

This API is tested by using POSTMAN, API TESTER, curl is working fine but coldfusion cannot get the correct result. Anyone know which part is wrong?

Upvotes: 1

Views: 360

Answers (1)

Dan Roberts
Dan Roberts

Reputation: 4694

You need to escape the callback url with encodeForURL.

<cfhttp method="GET" url="https://xxxx/Authentication/CorpPassAuth?scope=abc&callback_url=#encodeForURL("https://xxxx/apiresponse.cfm")#" result="a">

Upvotes: 1

Related Questions