Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
1
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-mock - npm Package Compare versions

Comparing version 5.3.0 to 5.3.1

2

package.json
{
"name": "fetch-mock",
"version": "5.3.0",
"version": "5.3.1",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

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

@@ -168,22 +168,2 @@ # fetch-mock [![Build Status](https://travis-ci.org/wheresrhys/fetch-mock.svg?branch=master)](https://travis-ci.org/wheresrhys/fetch-mock)

##### Example
```js
fetchMock
.mock('http://domain1', 200)
.mock('http://domain2', 'PUT', {
affectedRecords: 1
});
myModule.onlyCallDomain2()
.then(() => {
expect(fetchMock.called('http://domain2')).to.be.true;
expect(fetchMock.called('http://domain1')).to.be.false;
expect(fetchMock.calls().unmatched.length).to.equal(0);
expect(JSON.parse(fetchMock.lastUrl('http://domain2'))).to.equal('http://domain2/endpoint');
expect(JSON.parse(fetchMock.lastOptions('http://domain2').body)).to.deep.equal({prop: 'val'});
})
.then(fetchMock.restore)
```
## Troubleshooting and alternative installation

@@ -190,0 +170,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