mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 17:52:55 +00:00
Merge pull request #2681 from frewsxcv/patch-1
Use HTTPS if location protocol is HTTPS in iD.Connection
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
iD.Connection = function() {
|
||||
iD.Connection = function(useHttps) {
|
||||
if (typeof useHttps !== 'boolean') {
|
||||
useHttps = window.location.protocol === 'https:';
|
||||
}
|
||||
|
||||
var event = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'loaded'),
|
||||
url = 'http://www.openstreetmap.org',
|
||||
protocol = useHttps ? 'https:' : 'http:',
|
||||
url = protocol + '//www.openstreetmap.org',
|
||||
connection = {},
|
||||
inflight = {},
|
||||
loadedTiles = {},
|
||||
tileZoom = 16,
|
||||
oauth = osmAuth({
|
||||
url: 'http://www.openstreetmap.org',
|
||||
url: protocol + '//www.openstreetmap.org',
|
||||
oauth_consumer_key: '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
|
||||
oauth_secret: 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL',
|
||||
loading: authenticating,
|
||||
|
||||
@@ -2,13 +2,25 @@ describe('iD.Connection', function () {
|
||||
var c;
|
||||
|
||||
beforeEach(function () {
|
||||
c = new iD.Connection({});
|
||||
c = new iD.Connection();
|
||||
});
|
||||
|
||||
it('is instantiated', function () {
|
||||
expect(c).to.be.ok;
|
||||
});
|
||||
|
||||
it('allows insecure connections', function () {
|
||||
expect(c.changesetURL(2)).to.match(/^http:/);
|
||||
|
||||
c = new iD.Connection(false);
|
||||
expect(c.changesetURL(2)).to.match(/^http:/);
|
||||
});
|
||||
|
||||
it('allows secure connections', function () {
|
||||
c = new iD.Connection(true);
|
||||
expect(c.changesetURL(2)).to.match(/^https:/);
|
||||
});
|
||||
|
||||
describe('#changesetUrl', function() {
|
||||
it('provides a changeset url', function() {
|
||||
expect(c.changesetURL(2)).to.eql('http://www.openstreetmap.org/changeset/2');
|
||||
|
||||
Reference in New Issue
Block a user