Skip to content

Commit

Permalink
doc: add example for setting Vary: Accept-Encoding header in zlib.md
Browse files Browse the repository at this point in the history
PR-URL: #26308
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
mukulkhanna authored and addaleax committed Mar 1, 2019
1 parent 34905fc commit 40a5a93
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/api/zlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down

0 comments on commit 40a5a93

Please sign in to comment.