danwrong / restler

REST client library for node.js
MIT License
1.99k stars 390 forks source link

text/javascript Content-Type #72

Open dobesv opened 12 years ago

dobesv commented 12 years ago

I was briefly puzzled that when getting data from facebook the "auto" parser didn't work.

Turns out that facebook is sending the content-type as 'text/javascript; charset=UTF-8'

A little bit old-school but the 'auto' type might want to consider this to be one of the JSON content-types.

I guess it depends on whether or not it's more common that people fetch JSON data with this (incorrect) content-type or if they would sometimes use restler to download actual javascript code which they do not want to parse to JSON.

dobesv commented 12 years ago

Note that passing options of {parser:restler.parsers.json} worked just fine, so this isn't a major issue at all.

andresgottlieb commented 12 years ago

Thank you, that solution works. Please, anyone else, note that to be consistent with the examples it should be {parser:rest.parsers.json}