Comparing version 1.0.0-beta3 to 1.0.0-beta4
@@ -45,3 +45,4 @@ var _ = require('lodash'); | ||
Client.prototype.request = function(opts, cb) { | ||
opts = assignAuthHeader(opts, this.config.token); | ||
if (!opts.auth) opts = assignAuthHeader(opts, this.config.token); | ||
opts.headers = (opts.headers || {}); | ||
opts.headers.Accept = 'application/json'; | ||
@@ -61,3 +62,3 @@ opts.headers['User-Agent'] = 'gocardless-node/v' + constants.VERSION; | ||
var opts = { | ||
uri: this.config.baseUrl + constants.API_ROOT + '/confirm', | ||
path: constants.API_ROOT + '/confirm', | ||
method: 'POST', | ||
@@ -68,5 +69,2 @@ json: { | ||
}, | ||
headers: { | ||
Accept: 'application/json' | ||
}, | ||
auth: { | ||
@@ -77,5 +75,9 @@ user: this.config.appId, | ||
}; | ||
return request(opts, cb); | ||
return this.request(opts, cb); | ||
}; | ||
Client.prototype.webhookValid = function webhookValid(params) { | ||
return Signer.verify(params, this.config.appSecret); | ||
}; | ||
module.exports = Client; |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "1.0.0-beta3", | ||
"version": "1.0.0-beta4", | ||
"author": { | ||
@@ -11,0 +11,0 @@ "name": "Andy Appleton", |
# GoCardless Node.js client library | ||
## Version 1.0.0-beta3 note | ||
[![Build Status](https://travis-ci.org/gocardless/gocardless-node.png)](https://travis-ci.org/gocardless/gocardless-node) | ||
## Version 1.0.0-beta4 note | ||
This replaces the previous [gocardless npm module](https://npmjs.org/package/gocardless/0.1.1) and is not API compatible. It will be released as 1.0. | ||
@@ -6,0 +8,0 @@ |
@@ -203,5 +203,3 @@ var sinon = require('sinon'); | ||
client.confirmResource(params); | ||
expect(requestMock.args[0][0].headers).to.eql({ | ||
Accept: 'application/json' | ||
}); | ||
expect(requestMock.args[0][0].headers.Accept).to.be('application/json'); | ||
}); | ||
@@ -224,2 +222,17 @@ | ||
}); | ||
describe('#webhookValid', function() { | ||
var client; | ||
beforeEach(function() { | ||
client = new Client(config); | ||
}); | ||
it('delegates to Signer.verify with appSecret', function() { | ||
sinon.spy(Signer, 'verify'); | ||
var params = { some: 'data' }; | ||
client.webhookValid(params); | ||
expect(Signer.verify).was.calledWith(params, config.appSecret); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52582
44
1407
19