Skip to content

Commit

Permalink
Response JSON parsing and version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
iced committed Jul 16, 2012
1 parent 10cdb7e commit b724edf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iron_core",
"version": "0.0.3",
"version": "0.1.0",
"description": "Core library for Iron products",
"homepage": "https://github.com/iron-io/iron_core_node",
"author": "Andrew Kirilenko & Iron.io, Inc",
Expand Down
4 changes: 3 additions & 1 deletion src/client.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ class Client

@request(requestInfo, cb)

parseResponse: (error, response, body, cb) ->
parseResponse: (error, response, body, cb, parseJson = true) ->
if response.statusCode == 200
body = JSON.parse(body) if parseJson and typeof(body) == 'string'

cb(null, body)
else
cb(new Error(body), null)
Expand Down

0 comments on commit b724edf

Please sign in to comment.