mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +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) {
|
||||
throw new Error('[nuxt] [useFetch] request is missing.')
|
||||
}
|
||||
|
||||
const key = _key === autoKey ? '$f' + _key : _key
|
||||
|
||||
const _request = computed(() => {
|
||||
@ -70,6 +71,10 @@ export function useFetch<
|
||||
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 {
|
||||
server,
|
||||
lazy,
|
||||
|
Loading…
Reference in New Issue
Block a user