From 1ec15e15ab19b3b9c0e4afcb7b452dbf5f5abb4d Mon Sep 17 00:00:00 2001 From: "R.Frega" Date: Mon, 18 Jan 2016 14:15:21 -0200 Subject: [PATCH] Allow for a different host Check if `path` begins with "http" or "https" and refrain from preppeding the default host if it does. Changed in order to be able to use the package with Google Spreadsheets API (that uses a different host). --- google-api-async.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/google-api-async.js b/google-api-async.js index 8e8c20e..ae64eb8 100644 --- a/google-api-async.js +++ b/google-api-async.js @@ -47,6 +47,8 @@ GoogleApi = { options.headers = options.headers || {}; options.headers.Authorization = 'Bearer ' + user.services.google.accessToken; + path = /^http(s)?:\/\//.test(path)?path:this._host + '/' + path; + HTTP.call(method, this._host + '/' + path, options, function(error, result) { callback(error, result && result.data); });