mirror of https://github.com/nodejs/node.git
doc: add example for setting Vary: Accept-Encoding header in zlib.md
PR-URL: https://github.com/nodejs/node/pull/26308 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>pull/26364/head
parent
a32cbe1597
commit
86f13d674a
|
@ -107,6 +107,8 @@ const http = require('http');
|
|||
const fs = require('fs');
|
||||
http.createServer((request, response) => {
|
||||
const raw = fs.createReadStream('index.html');
|
||||
// Store both a compressed and an uncompressed version of the resource.
|
||||
response.setHeader('Vary: Accept-Encoding');
|
||||
let acceptEncoding = request.headers['accept-encoding'];
|
||||
if (!acceptEncoding) {
|
||||
acceptEncoding = '';
|
||||
|
|
Loading…
Reference in New Issue