Skip to content

Commit

Permalink
test: Remove a pointless test (#1383)
Browse files Browse the repository at this point in the history
This test was added in 1b5849a which set `_headers` on an intercepted `req` object.

Presumably subsequently, `_headers` became a property on `http.OutgoingMessage`.

It was later deprecated:
https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_headers_outgoingmessage_headernames

Suffice it to say that:

1. The assertion passes when run _without_ nock.
2. This test does not seem to any longer exercise any code from `nock`.
  • Loading branch information
paulmelnikow authored and gr2m committed Sep 4, 2019
1 parent 119b05a commit ca0ed16
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions tests/test_intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,37 +516,6 @@ test('isDone', async t => {
scope.done()
})

test('request headers exposed', t => {
const scope = nock('http://example.com')
.get('/')
.reply(200, 'Hello World!', { 'X-My-Headers': 'My Header value' })

// Testing that the req is augmented, so using `http`.
const req = http.get(
{
host: 'example.com',
method: 'GET',
path: '/',
port: 80,
headers: { 'X-My-Headers': 'My custom Header value' },
},
res => {
res.on('end', () => {
scope.done()
t.end()
})
// Streams start in 'paused' mode and must be started.
// See https://nodejs.org/api/stream.html#stream_class_stream_readable
res.resume()
}
)

t.equivalent(req._headers, {
'x-my-headers': 'My custom Header value',
host: 'example.com',
})
})

test('headers work', async t => {
const scope = nock('http://example.com')
.get('/')
Expand Down

0 comments on commit ca0ed16

Please sign in to comment.