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

service-worker-mock

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

service-worker-mock - npm Package Compare versions

Comparing version 1.10.1 to 1.10.2

10

models/Body.js

@@ -10,3 +10,3 @@ const Blob = require('./Blob');

this.bodyUsed = false;
this.body = new Blob([body]);
this.body = body instanceof Blob ? body : new Blob([body]);
}

@@ -18,15 +18,15 @@ arrayBuffer() {

blob() {
this.resolve('json', body => new Blob([body]));
return this.resolve('blob', body => new Blob([body]));
}
json() {
this.resolve('json', body => JSON.parse(body._text));
return this.resolve('json', body => JSON.parse(body.text));
}
text() {
this.resolve('json', body => body._text);
return this.resolve('text', body => body.text);
}
resolve(name, resolver) {
if (this.bodyUsed) throwBodyUsed('text');
if (this.bodyUsed) throwBodyUsed(name);
this.bodyUsed = true;

@@ -33,0 +33,0 @@ return Promise.resolve(resolver(this.body));

// stubs https://developer.mozilla.org/en-US/docs/Web/API/Response
class Response {
constructor(body, init) {
this.body = body || '';
const Body = require('./Body');
const isSupportedBodyType = (body) =>
(body === null) ||
(body instanceof Blob) ||
(typeof body === 'string');
class Response extends Body {
constructor(body = null, init) {
if (!isSupportedBodyType(body)) {
throw new TypeError('Response body must be one of: Blob, USVString, null');
}
super(body);
this.status = (init && typeof init.status === 'number') ? init.status : 200;

@@ -23,12 +33,4 @@ this.ok = this.status >= 200 && this.status < 300;

}
text() {
try {
return Promise.resolve(this.body.toString());
} catch (err) {
return Promise.resolve(Object.prototype.toString.apply(this.body));
}
}
}
module.exports = Response;
{
"name": "service-worker-mock",
"version": "1.10.1",
"version": "1.10.2",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": {

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