Skip to content

Commit

Permalink
Merge pull request #5 from Financial-Times/post-bugfix
Browse files Browse the repository at this point in the history
conditionally parsing as JSON (sometimes request does it for us)
  • Loading branch information
wheresrhys committed Nov 24, 2014
2 parents ff80e52 + 76c7340 commit fdbffdd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ft-poller",
"version": "1.0.0",
"version": "1.0.1",
"repository": {
"type": "git",
"url": "https://github.com/Financial-Times/ft-poller"
Expand Down
2 changes: 1 addition & 1 deletion src/poller.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Poller.prototype.fetch = function () {
var latency = new Date() - time;
if (response.statusCode === 200) {
self.emit('ok', response, latency);
return JSON.parse(response.body);
return self.options.json ? response.body : JSON.parse(response.body);
} else {
throw response.body;
}
Expand Down

0 comments on commit fdbffdd

Please sign in to comment.