New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-mock-shim

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-mock-shim - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

2

dist/request.js

@@ -142,3 +142,3 @@ /* eslint-disable */

// mock api
_mock(configs);
_mock.call(this, configs);
// Important!! Don't remove this return

@@ -145,0 +145,0 @@ // This return stays for Promise mechanism

{
"name": "axios-mock-shim",
"version": "1.1.7",
"version": "1.1.8",
"description": "A plugin build for easily using axios-mock-adapter with axios",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -97,6 +97,22 @@ # Axios Mock Shim

- **mock**
Trigger the mock feature without calling run, by default, calling `run` will trigger mock automatically, but sometimes we just want to define specific response with some params.
> Just like `with`, if `useMock` is set to `false`, this method will skip the mock. avoiding you from calling `mock` accidently in production mode.
```js
// Define some special situation response in dev
if (process.env.NODE_ENV === 'development') {
const getInfos = [{ id: 3000 }, {
test: 'This is test data',
}];
// trigger as folloing will let Shim plugin cache result for the params without calling a request
api.use('post', 'buy', getInfos[0]).with([400, getInfos[1]]).mock();
}
```
- **run()**
Execute the `AxiosRequest`
Execute the `AxiosRequest`, will execute real request by axios with auto checking for mock cache, if there's no cache yet, will mock & cache the result.

@@ -103,0 +119,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc