Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: master@{1405393433}
...
  • 11 commits
  • 3 files changed
  • 0 commit comments
  • 7 contributors
Showing with 9 additions and 9 deletions.
  1. +3 −3 lib/client.js
  2. +3 −3 package.json
  3. +3 −3 src/client.coffee
View
6 lib/client.js
@@ -170,10 +170,10 @@
if (error && !response) {
return cb(error, response, body);
- } else if (response.statusCode === 200) {
+ } else if (response.statusCode >= 200 && response.statusCode < 300) {
return cb(error, response, body);
} else {
- if (response.statusCode === 503 && retry < this.MAX_RETRIES) {
+ if ((response.statusCode === 503 || response.statusCode === 408) && retry < this.MAX_RETRIES) {
delay = Math.pow(4, retry) * 100 * Math.random();
return _.delay(requestBind, delay, requestInfo, cb, retry + 1);
} else {
@@ -237,7 +237,7 @@
}
if (error) {
return cb(error, null);
- } else if (response.statusCode === 200) {
+ } else if (response.statusCode >= 200 && response.statusCode < 300) {
if (parseJson && typeof body === 'string') {
body = JSON.parse(body);
}
View
6 package.json
@@ -1,14 +1,14 @@
{
"name": "iron_core",
- "version": "0.2.3",
+ "version": "0.2.5",
"description": "Core library for Iron products",
"homepage": "https://github.com/iron-io/iron_core_node",
"author": "Andrew Kirilenko & Iron.io, Inc",
"main": "./lib/client",
"dependencies": {
"pkginfo": "0.3.0",
- "underscore": "1.4.4",
- "request": "2.21.0"
+ "underscore": "1.7.0",
+ "request": "2.53.0"
},
"devDependencies": {
"coffee-script": "1.6.2"
View
6 src/client.coffee
@@ -114,10 +114,10 @@ class Client
request(requestInfo, (error, response, body) ->
if error && not response
cb(error, response, body)
- else if response.statusCode == 200
+ else if response.statusCode >= 200 and response.statusCode < 300
cb(error, response, body)
else
- if response.statusCode == 503 and retry < @MAX_RETRIES
+ if (response.statusCode == 503 or response.statusCode == 408) and retry < @MAX_RETRIES
delay = Math.pow(4, retry) * 100 * Math.random()
_.delay(requestBind, delay, requestInfo, cb, retry + 1)
else
@@ -163,7 +163,7 @@ class Client
parseResponse: (error, response, body, cb, parseJson = true) ->
if error
cb(error, null)
- else if response.statusCode == 200
+ else if response.statusCode >= 200 and response.statusCode < 300
body = JSON.parse(body) if parseJson and typeof(body) == 'string'
cb(null, body)

No commit comments for this range

Something went wrong with that request. Please try again.