Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions test/http2-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ test('Should support H2 connection', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'GET',
Expand Down Expand Up @@ -98,6 +104,12 @@ test('Should support H2 connection(multiple requests)', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

for (let i = 0; i < 3; i++) {
const sendBody = `seq ${i}`
const body = []
Expand Down Expand Up @@ -156,6 +168,12 @@ test('Should support H2 connection (headers as array)', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'GET',
Expand Down Expand Up @@ -215,6 +233,12 @@ test('Should support multiple header values with semicolon separator', async t =
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'GET',
Expand Down Expand Up @@ -298,6 +322,12 @@ test('Should support H2 connection(POST Buffer)', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const sendBody = 'hello!'
const body = []
const response = await client.request({
Expand Down
12 changes: 12 additions & 0 deletions test/http2-continue.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ test('Should handle h2 continue', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'POST',
Expand Down Expand Up @@ -92,6 +98,12 @@ test('Should deliver an early final response to an Expect: 100-continue request
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'POST',
Expand Down
18 changes: 18 additions & 0 deletions test/http2-pipelining-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ test('h2 client multiplexes concurrent requests by default (#4143)', async t =>
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const results = await Promise.all(
Array.from({ length: N }, () =>
client.request({ path: '/', method: 'GET' })
Expand Down Expand Up @@ -96,6 +102,12 @@ test('Pool with connections=1 multiplexes h2 streams on the single session (#414
})
after(() => pool.close())

pool.on('disconnect', () => {
if (!pool.closed && !pool.destroyed) {
t.fail('unexpected disconnect')
}
})

const results = await Promise.all(
Array.from({ length: N }, () =>
pool.request({ path: '/', method: 'GET' })
Expand Down Expand Up @@ -130,6 +142,12 @@ test('Client#pipelining keeps its h1 (RFC7230) semantic on an h2 client', async
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

// Even after negotiating h2, client.pipelining reflects only the user-set
// h1 pipelining factor — the h2 dispatch limit is maxConcurrentStreams.
const r = await client.request({ path: '/', method: 'GET' })
Expand Down
12 changes: 12 additions & 0 deletions test/http2-pseudo-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ test('Should provide pseudo-headers in proper order', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'GET'
Expand Down Expand Up @@ -79,6 +85,12 @@ test('The h2 pseudo-headers is not included in the headers', async t => {
})
after(() => client.close())

client.on('disconnect', () => {
if (!client.closed && !client.destroyed) {
t.fail('unexpected disconnect')
}
})

const response = await client.request({
path: '/',
method: 'GET'
Expand Down
Loading