-
-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/npm_and_yarn/compare-func-1.3.4
- Loading branch information
Showing
5 changed files
with
62 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {Readable} from 'node:stream'; | ||
import MultipartParser from '../../src/parsers/Multipart.js'; | ||
import {malformedMultipart} from '../../src/FormidableError.js'; | ||
|
||
import test from 'node:test'; | ||
import assert, { deepEqual } from 'node:assert'; | ||
|
||
|
||
|
||
test('MultipartParser does not hang', async (t) => { | ||
const mime = `--_\r\n--_--\r\n`; | ||
const parser = new MultipartParser(); | ||
parser.initWithBoundary('_'); | ||
try { | ||
for await (const {name, buffer, start, end} of Readable.from(mime).pipe(parser)) { | ||
console.log(name, buffer ? buffer.subarray(start, end).toString() : ''); | ||
} | ||
|
||
} catch (e) { | ||
deepEqual(e.code, malformedMultipart) | ||
return; | ||
// console.error('error'); | ||
// console.error(e); | ||
|
||
} | ||
assert(false, 'should catch error'); | ||
}); |