Skip to content
Myr

Remove usage of res._headers private field

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #3174

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent cd7d241 · Browse files · 4 files+11 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+11 added−5 removed

  • tests:+2 added−2 removed
  • other:+9 added−3 removed

4 files+11 added−5 removed

modified:lib/request.js+7 added-3 removed
450 unmodified lines
451 */452453defineGetter(req, 'fresh', function(){454 var method = this.method;455 var s = this.res.statusCode;455 var res = this.res456 var status = res.statusCode457458 // GET or HEAD for weak freshness validation only459 if ('GET' !== method && 'HEAD' !== method) return false;460461 // 2xx or 304 as per rfc2616 14.26461 if ((s >= 200 && s < 300) || 304 === s) {462 return fresh(this.headers, (this.res._headers || {}));462 if ((status >= 200 && status < 300) || 304 === status) {463 return fresh(this.headers, {464 'etag': res.get('ETag'),465 'last-modified': res.get('Last-Modified')466 })467 }468469 return false;470});
41 unmodified lines
modified:test/req.fresh.js+1 added-1 removed
modified:test/req.stale.js+1 added-1 removed
modified:History.md+2 added
1unreleased2==========34 * Add debug message when loading view engine5 * Remove usage of `res._headers` private field6 - Improves compatibility with Node.js 8 nightly7 * deps: debug@2.6.18 - Allow colors in workers9 - Deprecated `DEBUG_FD` environment variable set to `3` or higher10 - Fix error when running under React Native
3179 unmodified lines