New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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

to
1.5.7

7

CHANGELOG.md

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

## [1.5.7] - 2016-04-07
### Changed
* Remove unneeded try/catch
## [1.5.6] - 2016-04-06

@@ -213,3 +217,4 @@ ### Fixed

[1.5.6]: https://github.com/koopjs/featureservice/compare/v1.5.6...v1.5.6
[1.5.7]: https://github.com/koopjs/featureservice/compare/v1.5.6...v1.5.7
[1.5.6]: https://github.com/koopjs/featureservice/compare/v1.5.5...v1.5.6
[1.5.5]: https://github.com/koopjs/featureservice/compare/v1.5.4...v1.5.5

@@ -216,0 +221,0 @@ [1.5.4]: https://github.com/koopjs/featureservice/compare/v1.5.3...v1.5.4

109

index.js

@@ -503,68 +503,61 @@ var queue = require('async').queue

var self = this
try {
var url_parts = urlUtils.parse(uri)
var url_parts = urlUtils.parse(uri)
var opts = {
method: 'GET',
port: (url_parts.protocol === 'https:') ? 443 : url_parts.port || 80,
hostname: url_parts.hostname,
keepAlive: true,
path: url_parts.path,
headers: {
'User-Agent': 'featureservices-node',
'Accept-Encoding': 'gzip, deflate'
}
var opts = {
method: 'GET',
port: (url_parts.protocol === 'https:') ? 443 : url_parts.port || 80,
hostname: url_parts.hostname,
keepAlive: true,
path: url_parts.path,
headers: {
'User-Agent': 'featureservices-node',
'Accept-Encoding': 'gzip, deflate'
}
}
// make an http or https request based on the protocol
var req = ((url_parts.protocol === 'https:') ? https : http).request(opts, function (response) {
var encoding = response.headers['content-encoding']
var buffer = []
response
.on('error', function (err) { self._catchErrors(task, err, uri, cb) })
.pipe(decode(encoding))
.on('error', function (error) {
return self._catchErrors(task, error, uri, cb)
// make an http or https request based on the protocol
var req = ((url_parts.protocol === 'https:') ? https : http).request(opts, function (response) {
var encoding = response.headers['content-encoding']
var buffer = []
response
.on('error', function (err) { self._catchErrors(task, err, uri, cb) })
.pipe(decode(encoding))
.on('error', function (error) {
return self._catchErrors(task, error, uri, cb)
})
.on('data', function (chunk) { buffer.push(chunk) })
.on('end', function () {
// server responds 200 with error in the payload so we have to inspect
parse(buffer, function (err, json) {
if (err) return self._catchErrors(task, err, uri, cb)
if (!json || json.error) {
if (!json) json = {error: {}}
this.error = new Error('Request for a page of features failed')
this.error.timestamp = new Date()
this.error.body = json.error
this.error.code = json.error.code || 500
return self._catchErrors(task, this.error, uri, cb)
}
self._throttleQueue()
cb(null, json)
})
.on('data', function (chunk) { buffer.push(chunk) })
.on('end', function () {
// server responds 200 with error in the payload so we have to inspect
parse(buffer, function (err, json) {
if (err) return self._catchErrors(task, err, uri, cb)
if (!json || json.error) {
if (!json) json = {error: {}}
this.error = new Error('Request for a page of features failed')
this.error.timestamp = new Date()
this.error.body = json.error
this.error.code = json.error.code || 500
return self._catchErrors(task, this.error, uri, cb)
}
self._throttleQueue()
cb(null, json)
})
})
})
})
req.setTimeout(self.options.timeOut, function () {
this.error = new Error('The request timed out after ' + self.options.timeOut / 1000 + ' seconds.')
this.error.timestamp = new Date()
this.error.code = 504
req.abort()
})
req.setTimeout(self.options.timeOut, function () {
this.error = new Error('The request timed out after ' + self.options.timeOut / 1000 + ' seconds.')
this.error.timestamp = new Date()
this.error.code = 504
req.abort()
})
// we need this error catch to handle ECONNRESET
req.on('error', function (err) {
// if an error came in from setTimeOut, use that, else use the default error
var reported = this.error ? this.error : err
reported.timestamp = reported.timestamp || new Date()
self._catchErrors(task, reported, uri, cb)
})
// we need this error catch to handle ECONNRESET
req.on('error', function (err) {
// if an error came in from setTimeOut, use that, else use the default error
var reported = this.error ? this.error : err
reported.timestamp = reported.timestamp || new Date()
self._catchErrors(task, reported, uri, cb)
})
req.end()
} catch (e) {
this.log('error', e.message)
this.error = new Error('Unknown failure')
this.error.code = 500
self._catchErrors(task, this.error, uri, cb)
}
req.end()
}

@@ -571,0 +564,0 @@

{
"name": "featureservice",
"description": "Get all features from an Esri Feature Service",
"version": "1.5.6",
"version": "1.5.7",
"author": "Chris Helm",

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