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.7.0 to 1.7.1

51

models/Headers.js
// stubs https://developer.mozilla.org/en-US/docs/Web/API/Headers
class Headers extends Map {}
class Headers {
constructor(meta) {
if (meta && meta instanceof Headers) {
this._map = new Map(meta._map);
} else if (meta && typeof meta === 'object') {
this._map = new Map(Object.entries(meta));
} else {
this._map = new Map();
}
}
append(name, value) {
if (this._map.has(name)) {
value = `${this._map.get(name)},${value}`;
}
this._map.set(name, value);
}
delete(name) {
this._map.delete(name);
}
entries() {
return this._map.entries();
}
get(name) {
return this._map.get(name) || '';
}
has(name) {
return this._map.has(name);
}
keys() {
return this._map.keys();
}
set(name, value) {
this._map.set(name, value);
}
values() {
return this._map.values();
}
[Symbol.iterator]() {
return this._map.values();
}
}
Headers.Headers = (meta) => new Headers(meta);
module.exports = Headers;

20

models/Request.js

@@ -7,5 +7,5 @@ // stubs https://developer.mozilla.org/en-US/docs/Web/API/Request

const DEFAULT_HEADERS = [
['accept', '*/*']
];
const DEFAULT_HEADERS = {
accept: '*/*'
};

@@ -22,3 +22,15 @@ const throwBodyUsed = () => {

this.mode = (options && options.mode) || 'same-origin'; // FF defaults to cors
this.headers = (options && options.headers) || new Headers(DEFAULT_HEADERS);
// Transform options.headers to Headers object
if (options && options.headers) {
if (options.headers instanceof Headers) {
this.headers = options.headers;
} else if (typeof options.headers === 'object') {
this.headers = new Headers(options.headers);
} else {
throw new TypeError('Cannot construct request.headers: invalid data');
}
} else {
this.headers = new Headers(DEFAULT_HEADERS);
}
}

@@ -25,0 +37,0 @@

{
"name": "service-worker-mock",
"version": "1.7.0",
"version": "1.7.1",
"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