developerforce / Force.com-JavaScript-REST-Toolkit

ForceTK - a minimal Force.com REST API for JavaScript apps
BSD 3-Clause "New" or "Revised" License
315 stars 175 forks source link

createBlob() fails in Firefox #66

Closed flamencojones closed 9 years ago

flamencojones commented 9 years ago

When using Chrome or Safari, the Accept header is set to / (by the browser?), and all is good. In Firefox (38.0.1), however, the Accept header is: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 and the API return SOAP instead of JSON. Which in turn causes JSON.parse() to fail with JSON.parse: unexpected character at line 1 column 1 of the JSON data

A quick fix was to force the request header in forcetk.js blob(): request.setRequestHeader('Accept', '/');

metadaddy commented 9 years ago

Yes - I just pushed exactly this fix in fcbb8a7 :-)

Duplicate of #65.