mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 17:51:35 +00:00

PR-URL: https://github.com/nodejs/node/pull/36459 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
20 lines
430 B
JavaScript
20 lines
430 B
JavaScript
'use strict'
|
|
|
|
const CachePolicy = require('http-cache-semantics')
|
|
|
|
const iterableToObject = require('./iterable-to-object')
|
|
|
|
module.exports = function makePolicy (req, res) {
|
|
const _req = {
|
|
url: req.url,
|
|
method: req.method,
|
|
headers: iterableToObject(req.headers),
|
|
}
|
|
const _res = {
|
|
status: res.status,
|
|
headers: iterableToObject(res.headers),
|
|
}
|
|
|
|
return new CachePolicy(_req, _res, { shared: false })
|
|
}
|