From acd040ab9220a46a82f6ead02d647b2fda13eb4e Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Mon, 30 Dec 2024 00:14:33 +0100 Subject: [PATCH] chore: remove msgpack5 (#397) --- package.json | 1 - test/full-rewrite-body-content-type.test.js | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b13d0cbf..b0b5fcea 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,6 @@ "form-data": "^4.0.0", "got": "^11.8.6", "h2url": "^0.2.0", - "msgpack5": "^6.0.2", "neostandard": "^0.12.0", "nock": "^13.5.4", "proxy": "^2.1.1", diff --git a/test/full-rewrite-body-content-type.test.js b/test/full-rewrite-body-content-type.test.js index 99c00760..bfe537db 100644 --- a/test/full-rewrite-body-content-type.test.js +++ b/test/full-rewrite-body-content-type.test.js @@ -2,15 +2,17 @@ const t = require('tap') const Fastify = require('fastify') -const From = require('..') +const fastifyReplyFrom = require('..') const http = require('node:http') const get = require('simple-get').concat -const msgpack = require('msgpack5')() const instance = Fastify() -instance.register(From) +instance.register(fastifyReplyFrom) -t.plan(8) +const payload = { hello: 'world' } +const msgPackPayload = Buffer.from([0x81, 0xa5, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa5, 0x77, 0x6f, 0x72, 0x6c, 0x64]) + +t.plan(9) t.teardown(instance.close.bind(instance)) const target = http.createServer((req, res) => { @@ -22,7 +24,7 @@ const target = http.createServer((req, res) => { data.push(d) }) req.on('end', () => { - t.same(msgpack.decode(Buffer.concat(data)), { hello: 'world' }) + t.same(Buffer.concat(data), msgPackPayload) res.statusCode = 200 res.setHeader('content-type', 'application/json') res.end(JSON.stringify({ something: 'else' })) @@ -30,9 +32,10 @@ const target = http.createServer((req, res) => { }) instance.post('/', (request, reply) => { + t.same(request.body, payload) reply.from(`http://localhost:${target.address().port}`, { contentType: 'application/msgpack', - body: msgpack.encode(request.body) + body: msgPackPayload }) })