-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from phillipj/support-explicit-https
Add support for `https` parameter to force https even on non-443 port
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var expect = require('expect.js'); | ||
|
||
var PlexAPI = require('..'); | ||
|
||
describe('_serverScheme', function() { | ||
it('should use http by default', function() { | ||
var api = new PlexAPI({hostname: 'localhost'}); | ||
expect(api._serverScheme()).to.equal('http://'); | ||
}); | ||
it('should use https when port 443 is specified', function() { | ||
var api = new PlexAPI({hostname: 'localhost', port: 443}); | ||
expect(api._serverScheme()).to.equal('https://'); | ||
}); | ||
it('should use https when the https parameter is true', function() { | ||
var api = new PlexAPI({hostname: 'localhost', https: true}); | ||
expect(api._serverScheme()).to.equal('https://'); | ||
}); | ||
it('should use http when the https parameter is false, even on port 443', function() { | ||
var api = new PlexAPI({hostname: 'localhost', port: 443, https: false}); | ||
expect(api._serverScheme()).to.equal('http://'); | ||
}); | ||
}); |