Skip to content

Commit

Permalink
FIX #1
Browse files Browse the repository at this point in the history
  • Loading branch information
leeight committed Jun 29, 2015
1 parent b84cbf7 commit 40a49f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "baidubce-sdk",
"version": "0.0.12",
"version": "0.0.13",
"description": "baidu cloud engine node.js sdk",
"main": "index.js",
"directories": {
Expand Down
4 changes: 2 additions & 2 deletions src/bos_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BosClient.prototype.generatePresignedUrl = function (bucketName, key, timestamp,
'/v1',
bucketName || '',
key || ''
));
)).replace(/\\/g, '/');

headers = headers || {};
headers.Host = require('url').parse(config.endpoint).host;
Expand Down Expand Up @@ -540,7 +540,7 @@ BosClient.prototype._sendRequest = function (httpMethod, varArgs) {
'/v1',
args.bucketName || '',
args.key || ''
));
)).replace(/\\/g, '/');

var client = this;
var agent = this._httpAgent = new HttpClient(config);
Expand Down
5 changes: 4 additions & 1 deletion src/http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var EventEmitter = require('events').EventEmitter;

var u = require('underscore');
var Q = require('q');
var debug = require('debug')('HttpClient');

var H = require('./headers');

Expand Down Expand Up @@ -108,11 +109,13 @@ HttpClient.prototype.sendRequest = function (httpMethod, path, body, headers, pa
if (xbceDate) {
headers[H.X_BCE_DATE] = xbceDate;
}
debug('options = %j', options);
return client._doRequest(options, body, outputStream);
});
}
else if (util.isString(promise)) {
else if (typeof promise === 'string'){
headers[H.AUTHORIZATION] = promise;
debug('options = %j', options);
}
else {
throw new Error('Invalid signature = (' + promise + ')');
Expand Down

0 comments on commit 40a49f7

Please sign in to comment.