From 47e50fe3ce1ba90265fb8b396112aceae85ea032 Mon Sep 17 00:00:00 2001 From: zedgu Date: Fri, 8 Aug 2014 21:24:51 +0800 Subject: [PATCH] Fix #196 #207 tests/oauth2.js [remove] https never used [add] https url testing lib/oauth2.js [remove] creds never used --- lib/oauth2.js | 1 - tests/oauth2.js | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/oauth2.js b/lib/oauth2.js index efe5601..a182794 100644 --- a/lib/oauth2.js +++ b/lib/oauth2.js @@ -60,7 +60,6 @@ exports.OAuth2.prototype._chooseHttpLibrary= function( parsedUrl ) { exports.OAuth2.prototype._request= function(method, url, headers, post_body, access_token, callback) { - var creds = crypto.createCredentials({ }); var parsedUrl= URL.parse( url, true ); if( parsedUrl.protocol == "https:" && !parsedUrl.port ) { parsedUrl.port= 443; diff --git a/tests/oauth2.js b/tests/oauth2.js index f27e263..9352714 100644 --- a/tests/oauth2.js +++ b/tests/oauth2.js @@ -1,6 +1,5 @@ var vows = require('vows'), assert = require('assert'), - https = require('https'), OAuth2= require('../lib/oauth2').OAuth2, url = require('url'); @@ -210,5 +209,14 @@ vows.describe('OAuth2').addBatch({ oa.get("", {}); } } + }, + 'HTTPS URL connection testing, ': { + topic: function() { + var oa = new OAuth2("clientId", "clientSecret"); + oa._request('GET', 'https://www.bing.com/', {}, null, '', this.callback); + }, + 'we should correctly get the response code == 200': function(error, result, response) { + assert.equal(response.statusCode, 200); + } } }).export(module);