fix(nuxt): allow prefetching urls with query string (#25658)

This commit is contained in:
Daniel Roe 2024-02-07 09:28:47 +00:00 committed by GitHub
parent 36767e6b52
commit 25f1787922
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,9 +53,6 @@ export function preloadPayload (url: string, opts: LoadPayloadOptions = {}) {
const extension = renderJsonPayloads ? 'json' : 'js' const extension = renderJsonPayloads ? 'json' : 'js'
function _getPayloadURL (url: string, opts: LoadPayloadOptions = {}) { function _getPayloadURL (url: string, opts: LoadPayloadOptions = {}) {
const u = new URL(url, 'http://localhost') const u = new URL(url, 'http://localhost')
if (u.search) {
throw new Error('Payload URL cannot contain search params: ' + url)
}
if (u.host !== 'localhost' || hasProtocol(u.pathname, { acceptRelative: true })) { if (u.host !== 'localhost' || hasProtocol(u.pathname, { acceptRelative: true })) {
throw new Error('Payload URL must not include hostname: ' + url) throw new Error('Payload URL must not include hostname: ' + url)
} }