New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cacheable-response

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable-response - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # Change Log

<a name="1.4.2"></a>
## [1.4.2](https://github.com/Kikobeats/cacheable-response/compare/v1.4.1...v1.4.2) (2019-04-06)
<a name="1.4.1"></a>

@@ -7,0 +12,0 @@ ## [1.4.1](https://github.com/Kikobeats/cacheable-response/compare/v1.4.0...v1.4.1) (2019-04-06)

25

index.js

@@ -57,3 +57,4 @@ 'use strict'

const setHeaders = createSetHeaders({
revalidate: typeof revalidate === 'function' ? revalidate : () => revalidate
revalidate:
typeof revalidate === 'function' ? revalidate : () => revalidate
})

@@ -64,3 +65,5 @@

return async ({ req, res, ...opts }) => {
const hasForce = Boolean(req.query ? req.query.force : parse(req.url.split('?')[1]).force)
const hasForce = Boolean(
req.query ? req.query.force : parse(req.url.split('?')[1]).force
)

@@ -70,13 +73,13 @@ // Because req.url is relative, we need to convert it into an absolute url

const key = getKey(urlResolve('u:', req.url))
const cachedResult = await decompress(await cache.get(key))
const isHit = !hasForce && cachedResult !== undefined
const cachedData = await cache.get(key)
const hasData = cachedData !== undefined
const isHit = !hasForce && hasData
const {
etag: cachedEtag,
ttl = defaultTtl,
createdAt = Date.now(),
data,
...props
} = cachedResult || (await get({ req, res, ...opts }))
const cachedResult = await decompress(cachedData)
const { etag: cachedEtag, ttl = defaultTtl, createdAt = Date.now(), data, ...props } = isHit
? cachedResult
: await get({ req, res, ...opts })
const etag = cachedEtag || getEtag(data)

@@ -83,0 +86,0 @@

@@ -5,3 +5,3 @@ {

"homepage": "https://nicedoc.io/Kikobeats/cacheable-response",
"version": "1.4.1",
"version": "1.4.2",
"main": "index.js",

@@ -8,0 +8,0 @@ "author": {

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