ded / reqwest

browser asynchronous http requests
2.94k stars 343 forks source link

Uncaught SyntaxError: Unexpected identifier #74

Open haldean opened 12 years ago

haldean commented 12 years ago

I'm getting a syntax error on line 198 of the unminified version that's currently up on Github (commit 48fe7e). The full error is:

Uncaught SyntaxError: Unexpected identifier
success                                           reqwest.js:198
headers                                           reqwest.js:53
chadselph commented 12 years ago

This happens when eval is called on a JSON string instead of JSON.parse. The line of code that breaks is here: https://github.com/ded/reqwest/blob/master/src/reqwest.js#L190

But the actual broken code is the setType function which tries to get content type out of the URL and doesn't think to consult the Content-Type header.

https://github.com/ded/reqwest/blob/master/src/reqwest.js#L154