简体   繁体   中英

Posting to a ColdFusion function from angularJS

I have a login form that I'm using angular satellizer to post to a coldfusion cfc and check if the user account is valid.

I have the angular setup and I can make the post call to the cfc. I'm having some issue reading the data passed to the cfc.

When I dump the content passed to the cfc I get the following.

<cfset data = GetHttpRequestData()>
<cfdump var="#data#">

When I look on the header content on the dump I have a binary data and when I look at the encoding it says (Accept-Encoding: gzip, deflate).

How can I get the content passed to the cfc? My form post has an object with username and password. I can see it using the development tools and clicking on the headers request payload.

I'm using the Satellizer basic login authentication.

This should work:

<cfset data = toString( getHttpRequestData().content )>
<cfif isJSON( data )>
    <cfset data = deserializeJSON( data )>
</cfif>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM