xhr-sniffer
Version:
šØ Sniff HTTP requests making by XHR in the browser or HTTP module in Node.js
56 lines (35 loc) ⢠1.53 kB
Markdown
# xhr-sniffer
[](https://www.npmjs.com/package/xhr-sniffer)
[](https://badge.fury.io/js/xhr-sniffer)
[](https://www.npmjs.com/package/xhr-sniffer)
[](https://packagephobia.com/result?p=xhr-sniffer)
[](https://piecioshka.mit-license.org)
[](https://github.com/piecioshka/xhr-sniffer/actions/workflows/testing.yml)
šØ Sniff HTTP requests making by XHR in the browser or HTTP module in Node.js
## Preview š
<https://piecioshka.github.io/xhr-sniffer/demo/browser/>
## Features
- ā
Display logs of `XMLHttpRequests` in DevTools Console
- ā
Display logs of `http` module in `Node.js`
- āļø Sniffing `Fetch API`
## Usage
Installation:
```bash
npm install xhr-sniffer
```
### Sniff requests in `Node.js`
```javascript
const xhrSniffer = require('xhr-sniffer');
xhrSniffer.install();
// do XHR requests
xhrSniffer.uninstall();
```
### Sniff requests in `browser`
Attach files in `<head>` tag:
```html
<script src="xhr-sniffer/src/common.js"></script>
<script src="xhr-sniffer/src/browser.js"></script>
```
Next, make some XMLHttpRequests requests.
## License
[The MIT License](https://piecioshka.mit-license.org) @ 2018