diff --git a/lib/client.js b/lib/client.js index 4e6eb795..c6b6bb7b 100644 --- a/lib/client.js +++ b/lib/client.js @@ -3,7 +3,7 @@ var util = require('util'), request = requestRoot, _ = require('lodash'), to_json = require('xmljson').to_json, - package = require('../package.json'), + pkg = require('../package.json'), defaultConfig = { apiKey: null, apiSecret: null, @@ -37,7 +37,7 @@ Client.prototype.createSession = function(opts, cb) { url: this.c.apiUrl + this.c.endpoints.createSession, form: opts, headers: { - 'User-Agent': 'OpenTok-Node-SDK/' + package.version, + 'User-Agent': 'OpenTok-Node-SDK/' + pkg.version, 'X-TB-PARTNER-AUTH': this.c.apiKey+':'+this.c.apiSecret } }, function(err, resp, body) { diff --git a/lib/opentok.js b/lib/opentok.js index fc5fb415..0a032b93 100644 --- a/lib/opentok.js +++ b/lib/opentok.js @@ -11,7 +11,6 @@ var net = require('net'), Client = require('./client'), Session = require('./session'), archiving = require('./archiving'), - package = require('../package.json'), errors = require('./errors'); // Internal Constants @@ -299,7 +298,7 @@ var OpenTok = function(apiKey, apiSecret, env) { * OpenTok Media Router provides the following benefits: * *
  • archiveMode (String) — - * Whether the session is automatically archived ("always") or not + * Whether the session is automatically archived ("always") or not * ("manual"). By default, the setting is "manual", and you must call the * StartArchive() method of the OpenTok object to start archiving. To archive the * session (either automatically or not), you must set the mediaMode parameter to diff --git a/test/opentok-test.js b/test/opentok-test.js index 2f5ae0e4..73c845c3 100644 --- a/test/opentok-test.js +++ b/test/opentok-test.js @@ -5,7 +5,7 @@ var expect = require('chai').expect, // Subject var OpenTok = require('../lib/opentok.js'), Session = require('../lib/session.js'), - package = require('../package.json'); + pkg = require('../package.json'); // Fixtures var apiKey = '123456', @@ -71,7 +71,7 @@ describe('OpenTok', function() { it('sends its requests to the set apiUrl', function(done) { var scope = nock(apiUrl) .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=enabled") .reply(200, "SESSIONID123456Wed Mar 19 23:35:24 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 06:35:24 GMT', @@ -171,7 +171,7 @@ describe('OpenTok', function() { it('creates a new session', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=enabled") .reply(200, "SESSIONID123456Wed Mar 19 23:35:24 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 06:35:24 GMT', @@ -194,7 +194,7 @@ describe('OpenTok', function() { it('creates a media routed session', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=disabled") .reply(200, "SESSIONID123456Thu Mar 20 07:02:45 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 14:02:45 GMT', @@ -216,7 +216,7 @@ describe('OpenTok', function() { it('creates a media relayed session even if the media mode is invalid', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=enabled") .reply(200, "SESSIONID123456Thu Mar 20 07:02:45 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 14:02:45 GMT', @@ -238,7 +238,7 @@ describe('OpenTok', function() { it('creates a session with manual archive mode', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=disabled") .reply(200, "SESSIONID123456Thu Mar 20 07:02:45 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 14:02:45 GMT', @@ -260,7 +260,7 @@ describe('OpenTok', function() { it('creates a session with always archive mode', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=always&p2p.preference=disabled") .reply(200, "SESSIONID123456Thu Mar 20 07:02:45 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 14:02:45 GMT', @@ -282,7 +282,7 @@ describe('OpenTok', function() { it('creates a session with manual archive mode even if the archive mode is invalid', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=disabled") .reply(200, "SESSIONID123456Thu Mar 20 07:02:45 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 14:02:45 GMT', @@ -304,7 +304,7 @@ describe('OpenTok', function() { it('adds a location hint to the created session', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "location=12.34.56.78&archiveMode=manual&p2p.preference=enabled") .reply(200, "SESSIONID123456Thu Mar 20 07:17:22 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 14:17:22 GMT', @@ -348,7 +348,7 @@ describe('OpenTok', function() { it('complains when a server error takes place', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=enabled") .reply(503, "", { server: 'nginx', date: 'Thu, 20 Mar 2014 06:35:24 GMT', @@ -368,7 +368,7 @@ describe('OpenTok', function() { it('returns a Session that can generate a token', function(done) { var scope = nock('https://api.opentok.com:443') .matchHeader('x-tb-partner-auth', apiKey+':'+apiSecret) - .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+package.version)) + .matchHeader('user-agent', new RegExp("OpenTok-Node-SDK\/"+pkg.version)) .post('/session/create', "archiveMode=manual&p2p.preference=enabled") .reply(200, ""+sessionId+"123456Wed Mar 19 23:35:24 PDT 2014", { server: 'nginx', date: 'Thu, 20 Mar 2014 06:35:24 GMT',