mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
fix(nuxt): throw error on protocol relative path in useFetch
(#20052)
This commit is contained in:
parent
ab9f33a648
commit
1ae30ba474
@ -60,6 +60,7 @@ export function useFetch<
|
|||||||
if (!request) {
|
if (!request) {
|
||||||
throw new Error('[nuxt] [useFetch] request is missing.')
|
throw new Error('[nuxt] [useFetch] request is missing.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = _key === autoKey ? '$f' + _key : _key
|
const key = _key === autoKey ? '$f' + _key : _key
|
||||||
|
|
||||||
const _request = computed(() => {
|
const _request = computed(() => {
|
||||||
@ -70,6 +71,10 @@ export function useFetch<
|
|||||||
return unref(r)
|
return unref(r)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!opts.baseURL && typeof _request.value === 'string' && _request.value.startsWith('//')) {
|
||||||
|
throw new Error('[nuxt] [useFetch] the request URL must not start with "//".')
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
server,
|
server,
|
||||||
lazy,
|
lazy,
|
||||||
|
Loading…
Reference in New Issue
Block a user