rets-client
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -22,3 +22,3 @@ // Generated by CoffeeScript 1.10.0 | ||
return new Promise(function(resolve, reject) { | ||
var bodyStream, done, flush, flushed, handleEnd, handleError, headerField, headerValue, headers, interceptor, multipartBoundary, objectStream, parser, partDone, ref, ref1, streamError; | ||
var bodyStream, done, flush, flushed, handleEnd, handleError, headerField, headerValue, headers, interceptor, multipartBoundary, objectStream, objectStreamDone, parser, partDone, ref, ref1, streamError; | ||
multipartBoundary = (ref = headerInfo.contentType.match(/boundary="[^"]+"/ig)) != null ? ref[0].slice('boundary="'.length, -1) : void 0; | ||
@@ -33,2 +33,3 @@ if (!multipartBoundary) { | ||
objectStream = through2.obj(); | ||
objectStreamDone = false; | ||
headerField = ''; | ||
@@ -42,2 +43,5 @@ headerValue = ''; | ||
flushed = false; | ||
objectStream.on('end', function() { | ||
return objectStreamDone = true; | ||
}); | ||
handleError = function(err) { | ||
@@ -49,2 +53,5 @@ if (bodyStream) { | ||
} | ||
if (objectStreamDone) { | ||
return; | ||
} | ||
if (!err.error || !err.headerInfo) { | ||
@@ -58,3 +65,3 @@ err = { | ||
handleEnd = function() { | ||
if (done && partDone && flushed) { | ||
if (done && partDone && flushed && !objectStreamDone) { | ||
return objectStream.end(); | ||
@@ -89,5 +96,12 @@ } | ||
parser.onHeadersEnd = function() { | ||
var bodyStreamDone; | ||
bodyStream = through2(); | ||
bodyStreamDone = false; | ||
bodyStream.on('end', function() { | ||
return bodyStreamDone = true; | ||
}); | ||
handler(headers, bodyStream).then(function(object) { | ||
return objectStream.write(object); | ||
if (!objectStreamDone) { | ||
return objectStream.write(object); | ||
} | ||
})["catch"](handleError).then(function() { | ||
@@ -98,6 +112,10 @@ partDone = true; | ||
parser.onPartData = function(b, start, end) { | ||
return bodyStream.write(b.slice(start, end)); | ||
if (!bodyStreamDone) { | ||
return bodyStream.write(b.slice(start, end)); | ||
} | ||
}; | ||
return parser.onPartEnd = function() { | ||
bodyStream.end(); | ||
if (!bodyStreamDone) { | ||
bodyStream.end(); | ||
} | ||
return bodyStream = null; | ||
@@ -104,0 +122,0 @@ }; |
{ | ||
"name": "rets-client", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "A RETS client (Real Estate Transaction Standard).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
83241
1782