Registry / testing / axios-har-tracker

axios-har-tracker

JSON →
library0.8.0jsnpmunverified

A library for capturing HTTP Archive (HAR) files from axios requests. v0.8.0 supports axios 0.x/1.x. Tracks all requests made through axios and builds a HAR object that can be exported to a .har file. Inspired by request-har, differentiates by working specifically with axios. TypeScript types included. Not frequently updated.

npm install axios-har-tracker
INSTALL
IMPORT
SIG · AXIOS-HAR-TRACKER
A
axios-har-tracker
testingjavascriptv0.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AxiosHarTracker
import { AxiosHarTracker } from 'axios-har-tracker'
import AxiosHarTracker from 'axios-har-tracker'
Default export is not available; only named export.
AxiosHarTracker
const { AxiosHarTracker } = require('axios-har-tracker')
const AxiosHarTracker = require('axios-har-tracker')
CommonJS requires destructuring because there is no default export.
HarEntry
import { HarEntry } from 'axios-har-tracker'
Also exports types for HAR entries. Available as a named export.

Creates a tracker, makes GET and POST requests, then retrieves the HAR object.

import axios from 'axios'; import { AxiosHarTracker } from 'axios-har-tracker'; const tracker = new AxiosHarTracker(axios); (async () => { await axios.get('https://httpbin.org/get'); await axios.post('https://httpbin.org/post', { key: 'value' }); const har = tracker.getGeneratedHar(); console.log(JSON.stringify(har, null, 2)); })();
Debug
Known issues
gotchaAxiosHarTracker must be instantiated before any axios requests are made; otherwise requests are not captured.
fix
Ensure the tracker is created before calling axios.get/post/etc.
affects: >=0.0.0
gotchaThe library intercepts axios globally; avoid creating multiple trackers without clearing previous ones.
fix
Use a single tracker instance per session or call a reset method if available (not provided).
affects: >=0.0.0
deprecatedaxios 0.x is not officially supported in later versions of this library; check peer dependency.
fix
Use axios >=1.0.0 and verify compatibility.
affects: >=0.8.0
breakingIn v0.7.0, the export changed from default to named export "AxiosHarTracker".
fix
Use import { AxiosHarTracker } instead of import AxiosHarTracker from 'axios-har-tracker'.
affects: >=0.7.0
Errors
Common errors & fixes
TypeError: axios.create is not a function
AxiosHarTracker expects an axios instance, but a custom instance with missing method was passed.
fix
Pass the default axios export or create an instance using axios.create().
Cannot read property 'interceptors' of undefined
AxiosHarTracker received a value that is not an axios instance (e.g., undefined).
fix
Ensure you pass the axios module itself: new AxiosHarTracker(axios).
No HAR entries generated
Tracker was created after requests were already made.
fix
Move tracker instantiation before any axios calls.
Upgrade
Version history
0.8.0latest on npm
Audit
Dependencies
axiosrequiredpeer dependency; the library wraps axios to intercept requests
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
axios-har-tracker — npm install axios-har-tracker · libregistry