fake-xml-http-request

WebJar for fake-xml-http-request

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

fake-xml-http-request
Последняя версия

Последняя версия

1.4.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

fake-xml-http-request
WebJar for fake-xml-http-request
Ссылка на сайт

Ссылка на сайт

http://webjars.org

Скачать fake-xml-http-request

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/fake-xml-http-request/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>fake-xml-http-request</artifactId>
    <version>1.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/fake-xml-http-request/
implementation 'org.webjars.npm:fake-xml-http-request:1.4.0'
// https://jarcasting.com/artifacts/org.webjars.npm/fake-xml-http-request/
implementation ("org.webjars.npm:fake-xml-http-request:1.4.0")
'org.webjars.npm:fake-xml-http-request:jar:1.4.0'
<dependency org="org.webjars.npm" name="fake-xml-http-request" rev="1.4.0">
  <artifact name="fake-xml-http-request" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='fake-xml-http-request', version='1.4.0')
)
libraryDependencies += "org.webjars.npm" % "fake-xml-http-request" % "1.4.0"
[org.webjars.npm/fake-xml-http-request "1.4.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

FakeXMLHttpRequest Build Status

This library provide a fake XMLHttpRequest object for testing browser-based libraries. It is partially extracted (and in many places simplified) from Sinon.JS and attempts to match the behavior of XMLHttpRequest specification.

Why not just use Sinon.JS?

Sinon includes much more than just a fake XHR object which is useful in situations where you may not need mocks, spies, stubs, or fake servers.

How to use it

In addition to matching the native XMLHttpRequest's API, FakeXMLHttpRequest adds a respond function that takes three arguments: a HTTP response status number, a headers object, and a text response body:

// simulate successful response
import FakeXMLHttpRequest from "fake-xml-http-request";

let xhr = new FakeXMLHttpRequest();
xhr.respond(200, {"Content-Type": "application/json"}, '{"key":"value"}');
xhr.status; // 200
xhr.statusText; // "OK"
xhr.responseText; // '{"key":"value"}'

// simulate failed response
xhr = new FakeXMLHttpRequest();
xhr.abort();

There is no mechanism for swapping the native XMLHttpRequest or for recording, finding, or playing back requests. Libraries using FakeXMLHttpRequest should provide this behavior.

Testing

Tests are written in QUnit and run through the Karma test runner.

Run with:

karma start

Code of Conduct

In order to have a more open and welcoming community this project adheres to a code of conduct adapted from the contributor covenant.

Please adhere to this code of conduct in any interactions you have with this project's community. If you encounter someone violating these terms, please let a maintainer (@trek) know and we will address it as soon as possible.

org.webjars.npm

Pretender

Версии библиотеки

Версия
1.4.0