diff --git a/lib/interceptor/cache.js b/lib/interceptor/cache.js index e3fb202ad21..a60d92617ad 100644 --- a/lib/interceptor/cache.js +++ b/lib/interceptor/cache.js @@ -229,7 +229,7 @@ function handleResult ( } if (result.etag) { - headers.etag = result.etag + headers['if-none-match'] = result.etag } if (result.vary) { diff --git a/test/interceptors/cache.js b/test/interceptors/cache.js index 1b502c212b3..dc120c60b7b 100644 --- a/test/interceptors/cache.js +++ b/test/interceptors/cache.js @@ -155,6 +155,14 @@ describe('Cache Interceptor', () => { }).listen(0) const client = new Client(`http://localhost:${server.address().port}`) + .compose((dispatch) => { + return (opts, handler) => { + if (opts.headers) { + strictEqual(Object.prototype.hasOwnProperty.call(opts.headers, 'if-none-match'), false) + } + return dispatch(opts, handler) + } + }) .compose(interceptors.cache()) after(async () => {