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

@appzmonster/fetch-interceptor

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appzmonster/fetch-interceptor - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

6

CHANGELOG.md
# Change Log - @appzmonster/fetch-interceptor
### 1.0.5 (Sunday, 25 July 2021 02:12:00 GMT)
- Fixed error object thrown from MockRequest interceptor.
- Added network error option to MockRequest interceptor to simulate network error.
- Modified MockRequest interceptor error behaviour to follow Fetch API [spec](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch), resolve all request and only reject TypeError (when request fails to complete).
### 1.0.4 (Wednesday, 30 June 2021 15:57:00 GMT)

@@ -4,0 +10,0 @@

20

MockRequest.js

@@ -57,3 +57,5 @@ "use strict";

status: 200,
statusText: 'OK'
statusText: 'OK',
simulateNetworkError: false // To simulate request fail to complete, thus throwing error.
}, mock);

@@ -92,7 +94,17 @@ return _this;

});
/*
Reference: MDN
The Promise returned from fetch() won’t reject on HTTP error status even
if the response is an HTTP 404 or 500. Instead, as soon as the server responds
with headers, the Promise will resolve normally (with the ok property of the
response set to false if the response isn’t in the range 200–299), and it will
only reject on network failure or if anything prevented the request from completing.
*/
if (_this2._mock.ok === true) {
if (_this2._mock.simulateNetworkError === true) {
var networkError = new TypeError('Network request failed');
reject(networkError);
} else {
// Resolve response even if it's an error because the request completed.
resolve(mockResponse);
} else {
reject(mockResponse);
}

@@ -99,0 +111,0 @@ }, _this2._mock.delay);

2

package.json
{
"name": "@appzmonster/fetch-interceptor",
"version": "1.0.4",
"version": "1.0.5",
"description": "Fetch-interceptor is a JavaScript library to enable request interceptor feature on Fetch API. The library extends Fetch API and uses fluent API design to allow chaining of one or multiple request interceptors to a Fetch API request.",

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

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