MCPcopy Create free account
hub / github.com/ampproject/amphtml / constructor

Method constructor

src/polyfills/fetch.js:112–136  ·  view source on GitHub ↗

* @param {!XMLHttpRequest|!XMLHttpRequestDef} xhr

(xhr)

Source from the content-addressed store, hash-verified

110 * @param {!XMLHttpRequest|!XMLHttpRequestDef} xhr
111 */
112 constructor(xhr) {
113 /** @private @const {!XMLHttpRequest|!XMLHttpRequestDef} */
114 this.xhr_ = xhr;
115
116 /** @const {number} */
117 this.status = this.xhr_.status;
118
119 /** @const {string} */
120 this.statusText = this.xhr_.statusText;
121
122 /** @const {boolean} */
123 this.ok = this.status >= 200 && this.status < 300;
124
125 /** @const {!FetchResponseHeaders} */
126 this.headers = new FetchResponseHeaders(xhr);
127
128 /** @type {boolean} */
129 this.bodyUsed = false;
130
131 /** @type {?ReadableStream} */
132 this.body = null;
133
134 /** @type {?string} */
135 this.url = xhr.responseURL;
136 }
137
138 /**
139 * Create a copy of the response and return it.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected