Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"precommit": "npm run documentation && git add API.md"
},
"dependencies": {
"debug": "^3.1.0",
"jwt-simple": "^0.5.0",
"lodash": "^4.17.5",
"superagent": "^3.8.3",
Expand Down
11 changes: 11 additions & 0 deletions src/lib/rest-api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// const rest = require("restler");
const superagent = require("superagent");
const jwt = require("jwt-simple");
const debug = require("debug")("hull-client-node:rest-api");
const pkg = require("../../package.json");

const DEFAULT_HEADERS = {
Expand Down Expand Up @@ -64,6 +66,15 @@ function perform(client, config = {}, method = "get", path, params = {}, options
agent.timeout(options.timeout || 10000);
}

if( params.batch && process.env.NODE_ENV === "development" && process.env.DEBUG ) {
debug("perform:")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this just for cosmetic purposes ?

params.batch.forEach( b => {
var { type, body } = b
var { iss, iat, ...claims} = jwt.decode(b.headers['Hull-Access-Token'], config.secret)
debug("%j", { type, body, claims })
})
}

if (method === "get") {
return agent.query(params).then(res => res.body);
}
Expand Down