diff --git a/HISTORY.md b/HISTORY.md index 24208990..8ab9008c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,8 +3,10 @@ This incorporates all changes after 1.19.1 up to 1.20.2. + * deps: iconv-lite@0.5.2 + - Add encoding cp720 + - Add encoding UTF-32 * deps: raw-body@3.0.0-beta.1 - - deps: iconv-lite@0.5.2 2.0.0-beta.1 / 2021-12-17 ========================= diff --git a/package.json b/package.json index ec41dc13..4ab4d26f 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "depd": "2.0.0", "destroy": "1.2.0", "http-errors": "2.0.0", - "iconv-lite": "0.4.24", + "iconv-lite": "0.5.2", "on-finished": "2.4.1", "qs": "6.11.0", "raw-body": "3.0.0-beta.1", diff --git a/test/json.js b/test/json.js index 44262edd..d591420d 100644 --- a/test/json.js +++ b/test/json.js @@ -616,6 +616,13 @@ describe('bodyParser.json()', function () { test.expect(200, '{"name":"论"}', done) }) + it('should parse utf-32', function (done) { + var test = request(this.server).post('/') + test.set('Content-Type', 'application/json; charset=utf-32') + test.write(Buffer.from('fffe00007b000000220000006e000000610000006d00000065000000220000003a00000022000000ba8b0000220000007d000000', 'hex')) + test.expect(200, '{"name":"论"}', done) + }) + it('should parse when content-length != char length', function (done) { var test = request(this.server).post('/') test.set('Content-Type', 'application/json; charset=utf-8')