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

feat(useFetch): support sending the custom request to an absolute URL regardless baseURL #2210

Merged
merged 1 commit into from Nov 9, 2022

Conversation

sun0day
Copy link
Member

@sun0day sun0day commented Sep 16, 2022

Description

useFetch now supports sending the custom request to an absolute URL regardless baseURL

const useMyFetch = createFetch({ baseUrl: 'https://example.com', fetchOptions: {...}})

useMyFetch('test') // request https://example.com/test

// Before PR:
useMyFetch('https://a.com/test') // request https://example.com/https://a.com/test

// After PR:
useMyFetch('https://a.com/test') // request https://a.com/test

Additional context

The test suite for this feature is covered and passed

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

sxzz
sxzz previously approved these changes Oct 6, 2022
Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

/cc @antfu

@wheatjs
Copy link
Member

wheatjs commented Oct 6, 2022

Seems reasonable to me, maybe mention it in the documentation somewhere?

@sun0day
Copy link
Member Author

sun0day commented Oct 7, 2022

Seems reasonable to me, maybe mention it in the documentation somewhere?

It has mentioned in Type Declarations. @wheatjs @sxzz

image

@antfu antfu merged commit 934a893 into vueuse:main Nov 9, 2022
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.

None yet

4 participants