From c8dd240701632a0c23e691610193e13c8b10af4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Sat, 13 Jul 2024 21:52:47 +0300 Subject: [PATCH] fix port --- plugin.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin.js b/plugin.js index fec8923..5e6a54b 100644 --- a/plugin.js +++ b/plugin.js @@ -1,14 +1,15 @@ 'use strict' const fp = require('fastify-plugin') -const fastUri = require('fast-uri') +const { parse } = require('fast-uri') function fastifyUrlData (fastify, options, next) { fastify.decorateRequest('urlData', function (key) { const scheme = this.headers[':scheme'] ? this.headers[':scheme'] : this.protocol const host = this.hostname + const port = this.port const path = this.headers[':path'] || this.raw.url - const urlData = fastUri.parse(scheme + '://' + host + path) + const urlData = parse(`${scheme}://${host}:${port}${path}`) if (key) return urlData[key] return urlData })