Properly tagged but facing error: The start tag must have a matching end tag

Viewed 209

Sending http call to stripe API for getting Auth-token, but following code throws error: The start tag must have a matching end tag. An explicit end tag can be provided by adding </cffunction>. If the body of the tag is empty, you can use the shortcut <cffunction .../>.....

<cffunction name="getAuthToken" access="private" output="false">

 <cfhttp url="#variables.server#/v1/tokens" method="post" password="#variables.password#">

        <cfargument name="req" required="true" type="any">

        <cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded">

        <cfhttpparam type="header" name="Accept-Language" value="en_US">

        <cfhttpparam type="body" value="#req#">

    </cfhttp>
    
    <cfset response = deserializeJSON(cfhttp.FileContent)>
    
    <cfreturn response>
</cffunction>
1 Answers

It looks to me like you have that <cfargument ... tag in the wrong place. The compiler is getting confused by that. Move it up under the <cffunction ... tag instead.

Like this:

<cffunction name="getAuthToken" access="private" output="false">

   <cfargument name="req" required="true" type="any">

   <cfhttp url="#variables.server#/v1/tokens" method="post" password="#variables.password#">

       <cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded">

       <cfhttpparam type="header" name="Accept-Language" value="en_US">

       <cfhttpparam type="body" value="#req#">

    </cfhttp>

    <cfset response = deserializeJSON(cfhttp.FileContent)>

    <cfreturn response>
</cffunction>

Unless it's intended to be another <cfhttpparam ... in which case change it to that.

Related