Default return type not working

11 views
Skip to first unread message

Don Walter

unread,
Jun 3, 2015, 4:14:54 PM6/3/15
to taffy...@googlegroups.com
I'm trying out Taffy, currently using version 3.0.0, and have the taffy:default="true" param in my CustomSerializer.cfc on the getAsJSON function. I can specify XML or JSON and it works perfectly, but XML always comes back by default if I don't specify a return type even though I have JSON set to be default. Is there another setting that I'm missing somewhere? Thanks

<cffunction name="getAsJSON" taffy:mime="application/json" taffy:default="true" output="false">
    <cfreturn variables.jsonUtil.serializeJson(variables.data) />
</cffunction>

<cffunction name="getAsXML" taffy:mime="application/xml" output="false">
    <cfreturn variables.AnythingToXML.ToXML(variables.data) />
</cffunction>

Irvin Wilson

unread,
Jun 3, 2015, 5:44:39 PM6/3/15
to taffy...@googlegroups.com
Mine does same thing. Thought maybe I accidentally set XML as default somewhere.  Thanks for bringing it up.  I'll watch thread.  

--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Tuttle

unread,
Jun 3, 2015, 6:41:12 PM6/3/15
to taffy...@googlegroups.com

Are you making test requests through a web browser? If so, I suggest checking what Accept header is sent in the request. I suspect it's including XML as one of the acceptable response formats, so Taffy would be acting appropriately.

Don Walter

unread,
Jun 19, 2015, 3:11:36 PM6/19/15
to taffy...@googlegroups.com
You are exactly right, Adam... when I programmatically call the services, JSON is returned. Thanks!
Reply all
Reply to author
Forward
0 new messages