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

@serwist/cacheable-response

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serwist/cacheable-response - npm Package Compare versions

Comparing version 9.0.0-preview.10 to 9.0.0-preview.11

4

dist/CacheableResponse.d.ts

@@ -10,5 +10,3 @@ export interface CacheableResponseOptions {

*/
headers?: {
[headerName: string]: string;
};
headers?: HeadersInit;
}

@@ -15,0 +13,0 @@ /**

@@ -33,3 +33,5 @@ import { SerwistError, assert, logger, getFriendlyURL } from '@serwist/core/internal';

this._statuses = config.statuses;
this._headers = config.headers;
if (config.headers) {
this._headers = new Headers(config.headers);
}
}

@@ -50,5 +52,8 @@ isResponseCacheable(response) {

if (this._headers && cacheable) {
cacheable = Object.keys(this._headers).some((headerName)=>{
return response.headers.get(headerName) === this._headers[headerName];
});
for (const [headerName, headerValue] of this._headers.entries()){
if (response.headers.get(headerName) !== headerValue) {
cacheable = false;
break;
}
}
}

@@ -55,0 +60,0 @@ if (process.env.NODE_ENV !== "production") {

{
"name": "@serwist/cacheable-response",
"version": "9.0.0-preview.10",
"version": "9.0.0-preview.11",
"type": "module",
"description": "This library takes a Response object and determines whether it's cacheable based on a specific configuration.",
"description": "A module that takes a Response object and determines whether it's cacheable based on a specific configuration.",
"files": [

@@ -32,3 +32,3 @@ "src",

"dependencies": {
"@serwist/core": "9.0.0-preview.10"
"@serwist/core": "9.0.0-preview.11"
},

@@ -38,3 +38,3 @@ "devDependencies": {

"typescript": "5.4.0-dev.20240206",
"@serwist/constants": "9.0.0-preview.10"
"@serwist/constants": "9.0.0-preview.11"
},

@@ -41,0 +41,0 @@ "peerDependencies": {

@@ -20,3 +20,3 @@ /*

*/
headers?: { [headerName: string]: string };
headers?: HeadersInit;
}

@@ -32,3 +32,3 @@

private readonly _statuses?: CacheableResponseOptions["statuses"];
private readonly _headers?: CacheableResponseOptions["headers"];
private readonly _headers?: Headers;

@@ -74,3 +74,5 @@ /**

this._statuses = config.statuses;
this._headers = config.headers;
if (config.headers) {
this._headers = new Headers(config.headers);
}
}

@@ -104,5 +106,8 @@

if (this._headers && cacheable) {
cacheable = Object.keys(this._headers).some((headerName) => {
return response.headers.get(headerName) === this._headers![headerName];
});
for (const [headerName, headerValue] of this._headers.entries()) {
if (response.headers.get(headerName) !== headerValue) {
cacheable = false;
break;
}
}
}

@@ -109,0 +114,0 @@

Sorry, the diff of this file is not supported yet

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