Debian Codegraph @

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

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