How to use the fake-xml-http-request.DONE function in fake-xml-http-request

To help you get started, we’ve selected a few fake-xml-http-request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github folio-org / stripes-core / test / bigtest / network / patch-fake-xml-http-request.js View on Github external
this.responseText += body.substring(index, index + chunkSize);
    index += chunkSize;
  } while (index < body.length);

  var type = this.getResponseHeader("Content-Type");

  if (this.responseText && (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) {
    try {
      this.responseXML = parseXML(this.responseText);
    } catch (e) {
      // Unable to parse XML - no biggie
    }
  }

  if (this.async) {
    this._readyStateChange(FakeXMLHttpRequest.DONE);
  } else {
    this.readyState = FakeXMLHttpRequest.DONE;
  }
};
github folio-org / stripes-core / test / bigtest / network / patch-fake-xml-http-request.js View on Github external
function verifyRequestSent(xhr) {
  if (xhr.readyState == FakeXMLHttpRequest.DONE) {
      throw new Error("Request done");
  }
}

fake-xml-http-request

test infrastructure for a fake XMLHttpRequest object

MIT
Latest version published 4 years ago

Package Health Score

59 / 100
Full package analysis