Adds tests for node_stream

This commit is contained in:
Mukul Mishra 2017-08-05 01:00:37 +05:30
parent 18ede8c65d
commit d16709f5e4
7 changed files with 419 additions and 172 deletions

View file

@ -14,7 +14,7 @@
*/
import {
assert, createPromiseCapability, isInt, MissingPDFException,
assert, createPromiseCapability, MissingPDFException,
UnexpectedResponseException
} from '../shared/util';
import globalScope from '../shared/global_scope';
@ -352,18 +352,16 @@ function PDFNetworkStreamFullRequestReader(manager, options) {
}
PDFNetworkStreamFullRequestReader.prototype = {
getResponseHeader(name) {
let fullRequestXhrId = this._fullRequestId;
let fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
return fullRequestXhr.getResponseHeader(name);
},
_onHeadersReceived:
function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
var fullRequestXhrId = this._fullRequestId;
var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
let { allowRangeRequests, suggestedLength, } =
validateRangeRequestCapabilities({
getResponseHeader: this.getResponseHeader.bind(this),
getResponseHeader: (name) => {
return fullRequestXhr.getResponseHeader(name);
},
isHttp: this._manager.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
@ -377,7 +375,6 @@ PDFNetworkStreamFullRequestReader.prototype = {
}
var networkManager = this._manager;
var fullRequestXhrId = this._fullRequestId;
if (networkManager.isStreamingRequest(fullRequestXhrId)) {
// We can continue fetching when progressive loading is enabled,
// and we don't need the autoFetch feature.