feat: Add support for complete domain names in the new URL prefix. (#8893)

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
QuietlyChan
2024-11-08 17:17:34 +08:00
committed by GitHub
parent d52c750942
commit c1b2243adb

View File

@@ -321,7 +321,9 @@ const baseFetch = <T>(
}
const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
let urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
let urlWithPrefix = (url.startsWith('http://') || url.startsWith('https://'))
? url
: `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
const { method, params, body } = options
// handle query
@@ -494,7 +496,9 @@ export const ssePost = (
getAbortController?.(abortController)
const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
const urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
const urlWithPrefix = (url.startsWith('http://') || url.startsWith('https://'))
? url
: `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
const { body } = options
if (body)