arcgis-parser
Advanced tools
Comparing version 1.0.0 to 1.0.1
# Changelog | ||
## 1.0.1 - 2017-09-22 | ||
- Support HTTP & HTTPS | ||
## 1.0.0 - 2017-09-11 | ||
- Finalize beta of ArcGIS Parser |
{ | ||
"name": "arcgis-parser", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Parser for ArcGIS REST Services to human friendly JSON.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const https = require('https') | ||
const http = require('http') | ||
const URL = require('url') | ||
const format = require('./format') | ||
@@ -17,4 +19,7 @@ | ||
// Support both HTTP & HTTPS | ||
var request = (URL.parse(url).protocol === 'https:') ? request = https : request = http; | ||
return new Promise((resolve, reject) => { | ||
https.get(url, response => { | ||
request.get(url, response => { | ||
if (!response.headers['content-type'].match(/application\/json/i)) return reject('content-type must be application/json') | ||
@@ -21,0 +26,0 @@ var data = '' |
@@ -17,3 +17,3 @@ const path = require('path') | ||
t.deepEqual(capabilities, load.sync(output)) | ||
}) | ||
}).catch(error => t.fail(error)) | ||
}) | ||
@@ -24,10 +24,21 @@ t.end() | ||
test('get -- string', t => { | ||
test('get -- https', t => { | ||
get('https://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=pjson').then(capabilities => { | ||
t.notDeepEqual(capabilities, {}) | ||
}) | ||
}).catch(error => t.fail(error)) | ||
t.end(); | ||
}) | ||
test('get -- service', t => { | ||
get({service: 'ESRI_Imagery_World_2D'}).then(capabilities => { | ||
t.notDeepEqual(capabilities, {}) | ||
}) | ||
}).catch(error => t.fail(error)) | ||
t.end() | ||
}); | ||
test('get -- http', t => { | ||
get('http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=pjson').then(capabilities => { | ||
t.notDeepEqual(capabilities, {}) | ||
}).catch(error => t.fail(error)) | ||
t.end() | ||
}) | ||
@@ -34,0 +45,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18035
483
2