%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; require('../common'); const assert = require('assert'); const http = require('http'); function execute(options) { http.createServer(function(req, res) { const expectHeaders = { 'x-foo': 'boom', 'cookie': 'a=1; b=2; c=3', 'connection': 'close' }; // no Host header when you set headers an array if (!Array.isArray(options.headers)) { expectHeaders.host = `localhost:${this.address().port}`; } // no Authorization header when you set headers an array if (options.auth && !Array.isArray(options.headers)) { expectHeaders.authorization = `Basic ${Buffer.from(options.auth).toString('base64')}`; } this.close(); assert.deepStrictEqual(req.headers, expectHeaders); res.end(); }).listen(0, function() { options = Object.assign(options, { port: this.address().port, path: '/' }); const req = http.request(options); req.end(); }); } // Should be the same except for implicit Host header on the first two execute({ headers: { 'x-foo': 'boom', 'cookie': 'a=1; b=2; c=3' } }); execute({ headers: { 'x-foo': 'boom', 'cookie': [ 'a=1', 'b=2', 'c=3' ] } }); execute({ headers: [[ 'x-foo', 'boom' ], [ 'cookie', 'a=1; b=2; c=3' ]] }); execute({ headers: [ [ 'x-foo', 'boom' ], [ 'cookie', [ 'a=1', 'b=2', 'c=3' ]], ] }); execute({ headers: [ [ 'x-foo', 'boom' ], [ 'cookie', 'a=1' ], [ 'cookie', 'b=2' ], [ 'cookie', 'c=3'], ] }); // Authorization and Host header both missing from the second execute({ auth: 'foo:bar', headers: { 'x-foo': 'boom', 'cookie': 'a=1; b=2; c=3' } }); execute({ auth: 'foo:bar', headers: [ [ 'x-foo', 'boom' ], [ 'cookie', 'a=1' ], [ 'cookie', 'b=2' ], [ 'cookie', 'c=3'], ] });