0.3.0 • Published 4 years ago

@mocat/interceptor v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Mocat Interceptor

Intro

The part of Mocat which is used to interceptor http request.

Usage

Install dependencies:

yarn add --dev @mocat/interceptor

Then

import { eventEmitter, setupFetch, setupXHR } from '@mocat/interceptor'

// proxy http request
const resetFetch = setupFetch()
const resetXHR = setupXHR()

eventEmitter.onAny((event, value) => console.log(event, value))

// reset
resetFetch()
resetXHR()

Credits

The implementation of this module is power by the following prior art in the JavaScript ecosystem:

Caveats

  • @mocat/interceptor will replaces window.fetch and window.XMLHttpRequest with a proxy that Mocat can spy on and stub.
0.3.0

4 years ago

0.2.5

4 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago