Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #56 from ecstasy2/master
Browse files Browse the repository at this point in the history
Better checking for response content.
  • Loading branch information
mheffner committed May 12, 2016
2 parents 20cf2df + 19736bb commit 173e7e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/librato.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ var post_payload = function(options, proto, payload, retry)
}
if (/^application\/json/.test(res.headers['content-type'])) {
var meta = JSON.parse(d),
fields = meta.errors.params.type,
re = /'([^']+)' is a \S+, but was submitted as different type/;
if (fields && fields.length) {
if (meta.errors && meta.errors.params && meta.errors.params.type.length) {
var fields = meta.errors.params.type;
for (var i=0; i < fields.length; i++) {
var match = re.exec(fields[i]),
field = match && match[1];
Expand Down

0 comments on commit 173e7e8

Please sign in to comment.