Socket
Socket
Sign inDemoInstall

axios-har-tracker

Package Overview
Dependencies
25
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    axios-har-tracker

![npm](https://img.shields.io/npm/v/axios-har-tracker?color=9cf&style=plastic)


Version published
Weekly downloads
82
increased by32.26%
Maintainers
1
Install size
2.75 MB
Created
Weekly downloads
 

Readme

Source

npm

This library was designed for gathering HAR files from requests sent using axios

Credits

Inspiration and some pieces of the code comes from maciejmaciejewski/request-har

Usage

In order to use this package install it

npm install axios-har-tracker

and import it by

import { AxiosHarTracker } from 'axios-har-tracker'

and axios package

import axios from 'axios';

which will be passed into AxiosHarTracker constructor:

const axiosTracker = new AxiosHarTracker(axios); 

In order to perform an actual request use the axios.get/post/delete... call, examples:

await axios.get('http://httpstat.us/200');

or with catching an error

try {
    await axios.get('http://httpstat.us/404');
} catch (error) {
    console.log("An error appears after call to https://httpstat.us/404:", error);
}

Every single request is pushed into the object and user can get it by using

const generatedObject = axiosTracker.getGeneratedHar();

Object can be saved into a file in any time using e.g.

writeFileSync('example.har', JSON.stringify(generatedObject), 'utf-8');

Keywords

FAQs

Last updated on 29 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc