MCPcopy
hub / github.com/ampproject/amphtml / createXhrRequest

Function createXhrRequest

third_party/subscriptions-project/swg.js:13563–13571  ·  view source on GitHub ↗

* @param {string} method * @param {string} url * @return {!XMLHttpRequest} * @private

(method, url)

Source from the content-addressed store, hash-verified

13561 * @private
13562 */
13563function createXhrRequest(method, url) {
13564 const xhr = new XMLHttpRequest();
13565 if ('withCredentials' in xhr) {
13566 xhr.open(method, url, true);
13567 } else {
13568 throw new Error('CORS is not supported');
13569 }
13570 return xhr;
13571}
13572
13573/**
13574 * If 415 or in the 5xx range.

Callers 1

fetchPolyfillFunction · 0.70

Calls 1

openMethod · 0.45

Tested by

no test coverage detected