mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
update to fresh@2.0.0 (#5916)
fixes handling of If-Modified-Since in combination with If-None-Match
This commit is contained in:
parent
accafc652e
commit
4d713d2b76
|
|
@ -1,6 +1,6 @@
|
|||
unreleased
|
||||
=========================
|
||||
* remove:
|
||||
* remove:
|
||||
- `path-is-absolute` dependency - use `path.isAbsolute` instead
|
||||
* breaking:
|
||||
* `res.status()` accepts only integers, and input must be greater than 99 and less than 1000
|
||||
|
|
@ -20,6 +20,7 @@ unreleased
|
|||
* deps: type-is@^2.0.0
|
||||
* deps: content-disposition@^1.0.0
|
||||
* deps: finalhandler@^2.0.0
|
||||
* deps: fresh@^2.0.0
|
||||
|
||||
5.0.0-beta.3 / 2024-03-25
|
||||
=========================
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ defineGetter(req, 'hostname', function hostname(){
|
|||
|
||||
/**
|
||||
* Check if the request is fresh, aka
|
||||
* Last-Modified and/or the ETag
|
||||
* Last-Modified or the ETag
|
||||
* still match.
|
||||
*
|
||||
* @return {Boolean}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "^2.0.0",
|
||||
"fresh": "0.5.2",
|
||||
"fresh": "2.0.0",
|
||||
"http-errors": "2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
"methods": "~1.1.2",
|
||||
|
|
|
|||
|
|
@ -46,5 +46,25 @@ describe('req', function(){
|
|||
.get('/')
|
||||
.expect(200, 'false', done);
|
||||
})
|
||||
|
||||
it('should ignore "If-Modified-Since" when "If-None-Match" is present', function(done) {
|
||||
var app = express();
|
||||
const etag = '"FooBar"'
|
||||
const now = Date.now()
|
||||
|
||||
app.disable('x-powered-by')
|
||||
app.use(function(req, res) {
|
||||
res.set('Etag', etag)
|
||||
res.set('Last-Modified', new Date(now).toUTCString())
|
||||
res.send(req.fresh);
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.set('If-Modified-Since', new Date(now - 1000).toUTCString)
|
||||
.set('If-None-Match', etag)
|
||||
.expect(304, done);
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user