Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #38 from Giftbit/RetryIdempotent
Browse files Browse the repository at this point in the history
Retry errors 3 times on reasonably retryable errors.
  • Loading branch information
pushplay authored Apr 17, 2019
2 parents 53d92da + bc40432 commit a402888
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 61 deletions.
97 changes: 49 additions & 48 deletions package-lock.json

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

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightrail-client",
"version": "4.1.4",
"version": "4.1.5",
"description": "A Javascript and Typescript client for Lightrail",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -36,25 +36,25 @@
"@types/chai": "^4.1.7",
"@types/chai-as-promised": "^7.1.0",
"@types/dotenv-safe": "^5.0.3",
"@types/jsonwebtoken": "^8.3.0",
"@types/mocha": "^5.2.5",
"@types/jsonwebtoken": "^8.3.2",
"@types/mocha": "^5.2.6",
"@types/node": "^10.12.24",
"@types/parse-link-header": "^1.0.0",
"@types/superagent": "^3.8.6",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-exclude": "^1.0.12",
"chai-exclude": "^2.0.1",
"dotenv-safe": "^6.1.0",
"mitm": "^1.7.0",
"mocha": "^5.2.0",
"rimraf": "^2.6.3",
"ts-node": "^8.0.2",
"tslint": "^5.12.1",
"typescript": "^3.3.3",
"ts-node": "^8.1.0",
"tslint": "^5.15.0",
"typescript": "^3.4.3",
"uuid": "^3.3.2"
},
"dependencies": {
"jsonwebtoken": "^8.4.0",
"jsonwebtoken": "^8.5.1",
"parse-link-header": "^1.0.1",
"superagent": "^4.1.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export function request(method: string, path: string): superagent.Request {
throw new Error("apiKey not set");
}

// We can do some fancy things with superagent here like request rate
// throttling or automatic retry on particular codes.
// We can do some fancy things with superagent here like request rate throttling.
let r = superagent(method, configuration.restRoot + path)
.ok(() => true);
.ok(() => true)
.retry();

if (!!configuration.apiKey) {
r.set("Authorization", `Bearer ${configuration.apiKey}`);
Expand Down
2 changes: 1 addition & 1 deletion src/programs.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as chai from "chai";
import * as Lightrail from "./index";
import * as uuid from "uuid";
import chaiExclude = require("chai-exclude");
import chaiExclude from "chai-exclude";
import {CreateIssuanceParams, CreateProgramParams} from "./params";

chai.use(chaiExclude);
Expand Down
2 changes: 1 addition & 1 deletion src/values.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as chai from "chai";
import * as Lightrail from "./index";
import * as uuid from "uuid";
import {CreateContactParams, CreateValueParams} from "./params";
import chaiExclude = require("chai-exclude");
import chaiExclude from "chai-exclude";

chai.use(chaiExclude);

Expand Down

0 comments on commit a402888

Please sign in to comment.