natevw / fermata

Succinct native REST client, for client-side web apps and node.js. Turns URLs into (optionally: magic!) JavaScript objects.
328 stars 24 forks source link

Binary vs. text response, autoConvert #41

Closed natevw closed 8 years ago

natevw commented 10 years ago

Right now it's sort of an intentional coincidence that [in node.js at least] one can pass Buffer(0) as the data to a GET request to set the internal textResponse to false. It'd be nice to make this cleaner.

Also, some of the autoConvert types assume a text response. JSON and plain text both trigger a default UTF-8 conversion to string but the others don't.

natevw commented 10 years ago

This is getting addressed on the 'upcoming' branch. See #51 for discussion of API.

natevw commented 8 years ago

I think this is done enough. You can now pass an options object with responseType:'buffer', and autoConvert will handle it when possible.