Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

OskarLebuda
Copy link

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

src/_utils.ts Outdated
@@ -1,3 +1,5 @@
import { ProxyServerOptions } from "./types";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { ProxyServerOptions } from "./types";
import type { ProxyServerOptions } from "./types";

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed :)

Copy link

codecov bot commented Jan 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.63%. Comparing base (4e3e6d0) to head (555ad16).

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.
📢 Have feedback on the report? Share it here.

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[]) {
Copy link
Member

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.

Copy link
Author

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;
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've right!

@OskarLebuda OskarLebuda requested a review from pi0 January 21, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid normalizing double slashes
2 participants