-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid normalize url #70
base: main
Are you sure you want to change the base?
Conversation
src/_utils.ts
Outdated
@@ -1,3 +1,5 @@ | |||
import { ProxyServerOptions } from "./types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { ProxyServerOptions } from "./types"; | |
import type { ProxyServerOptions } from "./types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed :)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
=======================================
Coverage 43.63% 43.63%
=======================================
Files 8 8
Lines 644 644
Branches 75 76 +1
=======================================
Hits 281 281
Misses 361 361
Partials 2 2 ☔ View full report in Codecov by Sentry. |
src/_utils.ts
Outdated
@@ -176,7 +178,7 @@ export function hasEncryptedConnection(req) { | |||
* @api private | |||
*/ | |||
|
|||
export function urlJoin(...args: string[]) { | |||
export function urlJoin(options: ProxyServerOptions, ...args: string[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can alternatively use join
from ufo
. It handles join which much better care.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 💪🏻
src/server.ts
Outdated
@@ -39,6 +39,7 @@ export class ProxyServer extends EventEmitter { | |||
|
|||
this.options = options || {}; | |||
this.options.prependPath = options.prependPath !== false; | |||
this.options.normalizeUrl = options.normalizeUrl !== false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need an option if behavior is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've right!
Resolves #64 (comment)
I've added backport compatibility layer, so after this PR will be merged, we have to create another one for Nitro to avoid normalizing thouse slashes on nitro dev server.
https://github.com/nitrojs/nitro/blob/749f035dd00564fba7648712e5c9bd185591dc82/src/core/dev-server/server.ts#L334