Skip to content

Commit 40a5a93

Browse files
mukulkhannaaddaleax
authored andcommitted
doc: add example for setting Vary: Accept-Encoding header in zlib.md
PR-URL: #26308 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 34905fc commit 40a5a93

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

doc/api/zlib.md

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ const http = require('http');
107107
const fs = require('fs');
108108
http.createServer((request, response) => {
109109
const raw = fs.createReadStream('index.html');
110+
// Store both a compressed and an uncompressed version of the resource.
111+
response.setHeader('Vary: Accept-Encoding');
110112
let acceptEncoding = request.headers['accept-encoding'];
111113
if (!acceptEncoding) {
112114
acceptEncoding = '';

0 commit comments

Comments
 (0)