0.3.0 • Published 2 years ago

@mocat/interceptor v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 years ago

0.2.5

2 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago