Debian Codegraph @

node/rxjs/dist/esm5/internal/ajax/AjaxResponse.js

raw
1 import { getXHRResponse } from './getXHRResponse';
2 var AjaxResponse = (function () {
3 function AjaxResponse(originalEvent, xhr, request, type) {
4 if (type === void 0) { type = 'download_load'; }
5 this.originalEvent = originalEvent;
6 this.xhr = xhr;
7 this.request = request;
8 this.type = type;
9 var status = xhr.status, responseType = xhr.responseType;
10 this.status = status !== null && status !== void 0 ? status : 0;
11 this.responseType = responseType !== null && responseType !== void 0 ? responseType : '';
12 var allHeaders = xhr.getAllResponseHeaders();
13 this.responseHeaders = allHeaders
14 ?
15 allHeaders.split('\n').reduce(function (headers, line) {
16 var index = line.indexOf(': ');
17 headers[line.slice(0, index)] = line.slice(index + 2);
18 return headers;
19 }, {})
20 : {};
21 this.response = getXHRResponse(xhr);
22 var loaded = originalEvent.loaded, total = originalEvent.total;
23 this.loaded = loaded;
24 this.total = total;
25 }
26 return AjaxResponse;
27 }());
28 export { AjaxResponse };
29 //# sourceMappingURL=AjaxResponse.js.map