Skip to content

Commit

Permalink
post JSON instead of formdata
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensayshi committed Oct 30, 2014
1 parent 6e67eb0 commit aa05f02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Request.prototype.request = function (method, resource, params, data, fn) {
self.payload = '';
self.headers['Content-MD5'] = crypto.createHash('md5').update(self.path).digest().toString('hex');
} else {
self.payload = qs.stringify(data);
self.headers['Content-Type'] = 'application/x-www-form-urlencoded';
self.payload = JSON.stringify(data);
self.headers['Content-Type'] = 'application/json';
self.headers['Content-Length'] = self.payload ? self.payload.length : 0;
self.headers['Content-MD5'] = crypto.createHash('md5').update(self.payload).digest().toString('hex');
}
Expand Down
7 changes: 2 additions & 5 deletions test/api_client-promises.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ var assert = require('assert');
*/
var client = blocktrail({
apiKey : "MY_APIKEY",
apiSecret : "MY_APISECRET",
network : "BTC",
testnet : false,
apiVersion : 'v1'
apiSecret : "MY_APISECRET"
});

module.exports = {
Expand All @@ -26,7 +23,7 @@ module.exports = {
cb();
});
},
'test verify_address': function(cb) {
'test verifyAddress': function(cb) {
client.verifyAddress("16dwJmR4mX5RguGrocMfN9Q9FR2kZcLw2z", "HPMOHRgPSMKdXrU6AqQs/i9S7alOakkHsJiqLGmInt05Cxj6b/WhS7kJxbIQxKmDW08YKzoFnbVZIoTI2qofEzk=")
.then(function(result) {
assert.ok(result);
Expand Down

0 comments on commit aa05f02

Please sign in to comment.