googleapis
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -19,3 +19,4 @@ /** | ||
DefaultTransporter = require('./transporters.js'), | ||
querystring = require('querystring'); | ||
querystring = require('querystring'), | ||
url = require('url'), | ||
util = require('util'); | ||
@@ -67,3 +68,4 @@ | ||
for (var paramName in parameters) { | ||
if (parameters[paramName].location == 'query' && | ||
if ((parameters[paramName].location == 'query' || | ||
parameters[paramName].location == 'path') && | ||
params[paramName]) { | ||
@@ -81,3 +83,3 @@ return true; | ||
*/ | ||
BaseRequest.prototype.generatePayload = function() { | ||
BaseRequest.prototype.generatePayload = function(rootUrl) { | ||
return null; | ||
@@ -93,5 +95,7 @@ }; | ||
opt_callback = opt_callback || function() {}; | ||
var callback = this.handleResponse(opt_callback), | ||
requestOpts = this.generatePayload(); | ||
var rootUrl = url.parse(this.apiMeta.rootUrl), | ||
callback = this.handleResponse(opt_callback), | ||
requestOpts = this.generatePayload(rootUrl.protocol + '//' + rootUrl.host); | ||
if (this.authClient) { | ||
@@ -181,4 +185,4 @@ this.authClient.request(requestOpts, callback); | ||
*/ | ||
Request.prototype.generatePayload = function() { | ||
return !this.media ? this.generateBody() : this.generateUploadBody(); | ||
Request.prototype.generatePayload = function(rootUrl) { | ||
return !this.media ? this.generateBody(rootUrl) : this.generateUploadBody(rootUrl); | ||
}; | ||
@@ -190,6 +194,6 @@ | ||
*/ | ||
Request.prototype.generateBody = function() { | ||
Request.prototype.generateBody = function(rootUrl) { | ||
var path = this.generatePath(this.params); | ||
return { | ||
uri: BaseRequest.BASE_URL + path, | ||
uri: (rootUrl || BaseRequest.BASE_URL) + path, | ||
path: path, | ||
@@ -206,3 +210,3 @@ method: this.methodMeta.httpMethod, | ||
*/ | ||
Request.prototype.generateUploadBody = function() { | ||
Request.prototype.generateUploadBody = function(rootUrl) { | ||
var params = this.params || {}; | ||
@@ -214,3 +218,3 @@ | ||
return { | ||
uri: BaseRequest.BASE_URL + '/upload' + this.generatePath(params), | ||
uri: (rootUrl || BaseRequest.BASE_URL) + '/upload' + this.generatePath(params), | ||
method: this.methodMeta.httpMethod, | ||
@@ -228,3 +232,3 @@ headers: { | ||
return { | ||
uri: BaseRequest.BASE_URL + '/upload' + this.generatePath(params), | ||
uri: (rootUrl || BaseRequest.BASE_URL) + '/upload' + this.generatePath(params), | ||
method: this.methodMeta.httpMethod, | ||
@@ -286,3 +290,3 @@ multipart: [{ | ||
*/ | ||
BatchRequest.prototype.generatePayload = function() { | ||
BatchRequest.prototype.generatePayload = function(rootUrl) { | ||
// todo: implement | ||
@@ -292,3 +296,3 @@ var multipart = []; | ||
var body = []; | ||
var payload = request.generatePayload(); | ||
var payload = request.generatePayload(rootUrl); | ||
body.push(payload.method + ' ' + payload.path, ''); | ||
@@ -309,3 +313,3 @@ | ||
method: 'POST', | ||
uri: BaseRequest.BASE_URL + '/batch', | ||
uri: rootUrl + '/batch', | ||
multipart: multipart, | ||
@@ -312,0 +316,0 @@ headers: { |
{ | ||
"name": "googleapis", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js", |
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
54058
1164