Skip to content

Commit

Permalink
chore: adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
metcoder95 committed Jul 3, 2024
1 parent d96fa83 commit 781f376
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/llhttp/llhttp-wasm.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion lib/llhttp/llhttp_simd-wasm.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions test/client-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ const { describe, test } = require('node:test')
'llhttp_set_lenient_chunked_length',
'llhttp_set_lenient_keep_alive',
'llhttp_set_lenient_transfer_encoding',
'llhttp_set_lenient_version',
'llhttp_set_lenient_data_after_close',
'llhttp_set_lenient_optional_lf_after_cr',
'llhttp_set_lenient_optional_crlf_after_chunk',
'llhttp_set_lenient_optional_cr_before_lf',
'llhttp_set_lenient_spaces_after_chunk_size',
'llhttp_message_needs_eof'
])
await t.completed
Expand Down
17 changes: 9 additions & 8 deletions test/http-100.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { tspl } = require('@matteo.collina/tspl')
const { test, after } = require('node:test')
const { Client } = require('..')
const { Client, errors } = require('..')
const { createServer } = require('node:http')
const net = require('node:net')
const { once } = require('node:events')
Expand Down Expand Up @@ -48,22 +48,23 @@ test('error 103 body', async (t) => {
socket.write('\r\n')
socket.write('a\r\n')
})
after(() => server.close())
server.listen(0)

await once(server, 'listening')
const client = new Client(`http://localhost:${server.address().port}`)

after(() => server.close())
after(() => client.close())

client.request({
path: '/',
method: 'GET'
}, (err) => {
t.strictEqual(err.code, 'HPE_INVALID_CONSTANT')
})
client.on('disconnect', () => {
t.ok(true, 'pass')
})

t.rejects(client.request({
path: '/',
method: 'GET'
}), errors.HTTPParserError)

await t.completed
})

Expand Down
3 changes: 1 addition & 2 deletions test/issue-810.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test('https://github.com/mcollina/undici/issues/810 pipelining', async (t) => {
})

test('https://github.com/mcollina/undici/issues/810 pipelining 2', async (t) => {
t = tspl(t, { plan: 4 })
t = tspl(t, { plan: 3 })

const server = net.createServer(socket => {
socket.write('HTTP/1.1 200 OK\r\n')
Expand Down Expand Up @@ -140,7 +140,6 @@ test('https://github.com/mcollina/undici/issues/810 pipelining 2', async (t) =>
path: '/',
method: 'GET'
}, (err, data) => {
t.strictEqual(err.code, 'HPE_INVALID_CONSTANT')
t.ok(err instanceof errors.HTTPParserError)
})
await t.completed
Expand Down

0 comments on commit 781f376

Please sign in to comment.