Skip to content

Commit 59c1d58

Browse files
committed
v2.0.1
1 parent 5eea8ec commit 59c1d58

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 2.0.1 (2022-07-14)
2+
3+
* Add debug option to output API call requests and responses
4+
15
### 2.0.0 (2022-07-14)
26

37
* Repository detached from original (and the fork is now stand alone)

lib/luno.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const https = require('https')
44
const path = require('path')
55
const querystring = require('querystring')
66
const config = require(path.join(__dirname, '..', 'package'))
7+
const Debug = require('debug')
8+
9+
const debugReq = Debug('luno:req')
10+
const debugRes = Debug('luno:res')
711

812
const defaultHeaders = {
913
'Accept': 'application/json',
@@ -91,6 +95,7 @@ Luno.prototype._request = function (method, resourcePath, data, callback) {
9195

9296
const apiCallRate = this.apiCallRate
9397
const promise = new Promise(function (resolve, reject) {
98+
debugReq(options.method + ' ' + options.path)
9499
const req = https.request(options)
95100
req.on('response', function (res) {
96101
let response = ''
@@ -102,6 +107,7 @@ Luno.prototype._request = function (method, resourcePath, data, callback) {
102107
})
103108

104109
res.on('end', function () {
110+
debugRes(response)
105111
if (res.statusCode !== 200) {
106112
let lunoApiError
107113
try {

package-lock.json

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "luno-api-node",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"author": "dutu@protonmail.com",
55
"description": "A simple wrapper for the Luno API.",
66
"license": "MIT",
@@ -26,5 +26,8 @@
2626
"codecov": "^3.8.3",
2727
"sinon": "^14.0.0",
2828
"tap": "^16.3.0"
29+
},
30+
"dependencies": {
31+
"debug": "^4.3.4"
2932
}
3033
}

0 commit comments

Comments
 (0)