Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

featureservice

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

featureservice - npm Package Compare versions

Comparing version 1.5.12 to 1.5.13

test/fixtures/features.json

5

CHANGELOG.md

@@ -5,2 +5,6 @@ # Change Log

## [1.5.13] - 2018-01-31
### Fixed
* Parse out html at the end of an otherwise valid response
## [1.5.12] - 2017-12-29

@@ -237,2 +241,3 @@ ### Changed

[1.5.13]: https://github.com/koopjs/featureservice/compare/v1.5.12...v1.5.13
[1.5.12]: https://github.com/koopjs/featureservice/compare/v1.5.11...v1.5.12

@@ -239,0 +244,0 @@ [1.5.11]: https://github.com/koopjs/featureservice/compare/v1.5.10...v1.5.11

9

index.js

@@ -98,2 +98,9 @@ var queue = require('async').queue

return callback(new Error('Received HTML or plain text when expecting JSON'))
} else if (/\n<!DOCTYPE html>(\n|.|\s)*$/.test(data)) {
try {
json = JSON.parse(data.replace(/\n<!DOCTYPE html>(\n|.|\s)*$/, ''))
return callback(null, json)
} catch (e) {
return callback(new Error('Failed to parse server response'))
}
}

@@ -334,3 +341,3 @@ return callback(new Error('Failed to parse server response'))

var canPage = layer.advancedQueryCapabilities && layer.advancedQueryCapabilities.supportsPagination
if (canPage && this.hosted) return callback(null, this._offsetPages(nPages, size))
if (canPage) return callback(null, this._offsetPages(nPages, size))

@@ -337,0 +344,0 @@ if (!meta.oid) return callback(new Error('ObjectID type field not found, unable to page'))

2

package.json
{
"name": "featureservice",
"description": "Get all features from an Esri Feature Service",
"version": "1.5.12",
"version": "1.5.13",
"author": "Chris Helm",

@@ -6,0 +6,0 @@ "bugs": {

@@ -414,11 +414,11 @@ var sinon = require('sinon')

test('requesting a page of features and getting an html response', function (t) {
var page = new Buffer('</html></html>')
var page = Buffer.from('</html></html>')
var fixture = nock('http://servicesqa.arcgis.com')
fixture.get('/97KLIFOSt5CxbiRI/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0/query?outSR=4326&f=json&outFields=*&where=1=1&resultOffset=1000&resultRecordCount=1000&geometry=&returnGeometry=true&returnZ=true&geometryPrecision=')
fixture.get('/97KLIFOSt5CxbiRJ/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0/query?outSR=4326&f=json&outFields=*&where=1=1&resultOffset=1000&resultRecordCount=1000&geometry=&returnGeometry=true&returnZ=true&geometryPrecision=')
.times(4)
.reply(200, function () { return page })
var service = new FeatureService('http://servicesqa.arcgis.com/97KLIFOSt5CxbiRI/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0', {backoff: 1})
var task = {req: 'http://servicesqa.arcgis.com/97KLIFOSt5CxbiRI/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0/query?outSR=4326&f=json&outFields=*&where=1=1&resultOffset=1000&resultRecordCount=1000&geometry=&returnGeometry=true&returnZ=true&geometryPrecision='}
var service = new FeatureService('http://servicesqa.arcgis.com/97KLIFOSt5CxbiRJ/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0', {backoff: 1})
var task = {req: 'http://servicesqa.arcgis.com/97KLIFOSt5CxbiRJ/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0/query?outSR=4326&f=json&outFields=*&where=1=1&resultOffset=1000&resultRecordCount=1000&geometry=&returnGeometry=true&returnZ=true&geometryPrecision='}

@@ -432,2 +432,21 @@ service._requestFeatures(task, function (err, json) {

test('requesting a page of features and getting an html response tacked on', function (t) {
var features = require('./fixtures/features.json')
var page = Buffer.from(JSON.stringify(features) + "\n<!DOCTYPE html>")
var fixture = nock('http://servicesqa.arcgis.com')
fixture.get('/97KLIFOSt5CxbiRK/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0/query?outSR=4326&f=json&outFields=*&where=1=1&resultOffset=1000&resultRecordCount=1000&geometry=&returnGeometry=true&returnZ=true&geometryPrecision=')
.times(4)
.reply(200, function () { return page })
var service = new FeatureService('http://servicesqa.arcgis.com/97KLIFOSt5CxbiRK/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0', { backoff: 1 })
var task = { req: 'http://servicesqa.arcgis.com/97KLIFOSt5CxbiRK/arcgis/rest/services/QA_data_simple_point_5000/FeatureServer/0/query?outSR=4326&f=json&outFields=*&where=1=1&resultOffset=1000&resultRecordCount=1000&geometry=&returnGeometry=true&returnZ=true&geometryPrecision=' }
service._requestFeatures(task, function (err, json) {
t.notOk(err)
t.equal(json.features.length, 1)
t.end()
})
})
test('requesting a page of features and getting an empty response', function (t) {

@@ -434,0 +453,0 @@ var fixture = nock('http://servicesqa.arcgis.com')

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc