core-ajax - Firefox passing back xml when contentType 'application/json' specified

160 views
Skip to first unread message

Kelly St. John

unread,
Nov 25, 2014, 3:27:20 PM11/25/14
to polym...@googlegroups.com
I have come across an issue where Firefox is passing back xml in the absence of an additional header being added (i.e. "Accept":  "application/json").  It seems Firefox doesn't act on 'Content-Type' specification?

Has anyone else encountered this issue?  Is this expected behaviour at this point?

ps:  I am using polymer v 0.5.1


Arthur Evans

unread,
Nov 25, 2014, 5:21:20 PM11/25/14
to Kelly St. John, polymer-dev
Hi Kelly,

Can you add a little more detail? Is the problem that the remote web server is returning XML despite the fact that you're requesting JSON? Or that core-ajax under Firefox is trying to parse XML as JSON?

The core-ajax contentType property sets the content type on the request -- for example, if you're sending a POST request.

A test case that reproduces the problem would be ideal.

Thanks,
Arthur


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/a9bfe56b-a726-47e4-b7d7-ba976dfc362e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kelly St. John

unread,
Nov 25, 2014, 6:17:38 PM11/25/14
to polym...@googlegroups.com, ke...@qfin.net
Hi Arthur,

Due to the fact that contentType only pertains to the request (that slipped my mind), I should have also noted in my original post that core-ajax's 'handleAs' attribute is set to 'json' as well.  The issue is that in Firefox, the response's xhr.responseText is XML, not json (it responds with json in Chrome).  In this case it was a GET call.  Adding the additional header ' "Accept: application/json" ' did seem to resolve the issue...but it didn't sit right with me that I should have to add that header to the various ajax calls for the site, just to appease Firefox.

ps:  I am having another with this site in Firefox as well (potentially more serious issue actually).  I'm getting an unexpected error during an observer callback (triggered via a 'Changed' function on a javascript object).  (polymer.js line 4894) 

Kelly  

ma...@timtwillis.com

unread,
Feb 5, 2015, 9:12:42 AM2/5/15
to polym...@googlegroups.com
Running into the same issue with polymer 0.5.4

ma...@timtwillis.com

unread,
Feb 5, 2015, 9:12:46 AM2/5/15
to polym...@googlegroups.com
Running into the same issue with polymer 0.5.4

On Tuesday, November 25, 2014 at 3:27:20 PM UTC-5, Kelly St. John wrote:

ma...@timtwillis.com

unread,
Feb 5, 2015, 9:22:21 AM2/5/15
to polym...@googlegroups.com


On Tuesday, November 25, 2014 at 3:27:20 PM UTC-5, Kelly St. John wrote:
Reply all
Reply to author
Forward
0 new messages