diff --git a/index.js b/index.js index 5bb536d0..c84d801a 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const http2 = require('node:http2') const fp = require('fastify-plugin') const { LruMap } = require('toad-cache') const querystring = require('fast-querystring') -const fastContentTypeParse = require('fast-content-type-parse') +const contentTypeParse = require('content-type').parse const Stream = require('node:stream') const buildRequest = require('./lib/request') const { @@ -133,7 +133,7 @@ const fastifyReplyFrom = fp(function from (fastify, opts, next) { // Per RFC 7231 ยง3.1.1.5 if this header is not present we MAY assume application/octet-stream let contentType = 'application/octet-stream' if (req.headers['content-type']) { - const plainContentType = fastContentTypeParse.parse(req.headers['content-type']) + const plainContentType = contentTypeParse(req.headers['content-type'], { parameters: false }) contentType = plainContentType.type } diff --git a/package.json b/package.json index c2882a6d..10bee688 100644 --- a/package.json +++ b/package.json @@ -76,8 +76,8 @@ }, "dependencies": { "@fastify/error": "^4.0.0", + "content-type": "^2.0.0", "end-of-stream": "^1.4.4", - "fast-content-type-parse": "^3.0.0", "fast-querystring": "^1.1.2", "fastify-plugin": "^5.0.1", "toad-cache": "^3.7.0", @@ -86,4 +86,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +}