Skip to content

fix(utils): trim trailing whitespace from base URLs (resolves #530)#531

Open
crayonlu wants to merge 2 commits intounjs:mainfrom
crayonlu:fix/trim-base-cr-530
Open

fix(utils): trim trailing whitespace from base URLs (resolves #530)#531
crayonlu wants to merge 2 commits intounjs:mainfrom
crayonlu:fix/trim-base-cr-530

Conversation

@crayonlu
Copy link

Fixes a bug where baseURL values that include trailing control/whitespace characters (e.g., \r) caused incorrect URL merging (the path was dropped and only query params remained). This change trims trailing whitespace from the provided base before joining paths and adds a regression test.

ofetch('/path', {
  baseURL: 'https://example.org/\r',
  query: { q: 'y' },
  onRequest: [({ request }) => console.log(request.toString())]
});

// wrong: https://example.org/?q=y
// expect: https://example.org/path?q=y

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.

1 participant