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: nodejs#26308
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
mukulkhanna authored and Trott committed Feb 28, 2019
1 parent a32cbe1 commit 86f13d6
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 86f13d6

Please sign in to comment.