mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
minor fixes
This commit is contained in:
parent
aef2199402
commit
60714ecfc0
@ -74,6 +74,14 @@ module.exports = class MetaRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
// Emulate getPreloadFiles from vue-server-renderer (works for JS chunks only)
|
||||
meta.getPreloadFiles = () => clientManifest.initial.map(r => ({
|
||||
file: r,
|
||||
fileWithoutQuery: r,
|
||||
asType: 'script',
|
||||
extension: 'js'
|
||||
}))
|
||||
|
||||
// Set meta tags inside cache
|
||||
this.cache.set(url, meta)
|
||||
|
||||
|
@ -280,7 +280,7 @@ module.exports = class Renderer {
|
||||
const ENV = this.options.env
|
||||
|
||||
if (this.noSSR || spa) {
|
||||
const { HTML_ATTRS, BODY_ATTRS, HEAD, BODY_SCRIPTS, resourceHints } = await this.metaRenderer.render(context)
|
||||
const { HTML_ATTRS, BODY_ATTRS, HEAD, BODY_SCRIPTS, getPreloadFiles } = await this.metaRenderer.render(context)
|
||||
const APP = `<div id="__nuxt">${this.resources.loadingHTML}</div>` + BODY_SCRIPTS
|
||||
|
||||
// Detect 404 errors
|
||||
@ -297,7 +297,7 @@ module.exports = class Renderer {
|
||||
ENV
|
||||
})
|
||||
|
||||
return { html, resourceHints }
|
||||
return { html, getPreloadFiles }
|
||||
}
|
||||
|
||||
// Call renderToString from the bundleRenderer and generate the HTML (will update the context as well)
|
||||
@ -312,7 +312,7 @@ module.exports = class Renderer {
|
||||
HEAD += `<base href="${this.options.router.base}">`
|
||||
}
|
||||
|
||||
if (this.options.render.preloadLinks) {
|
||||
if (this.options.render.resourceHints) {
|
||||
HEAD += context.renderResourceHints()
|
||||
}
|
||||
|
||||
|
@ -223,8 +223,6 @@ test('/no-ssr (client-side)', async t => {
|
||||
|
||||
test('ETag Header', async t => {
|
||||
const { headers: { etag } } = await rp(url('/stateless'), { resolveWithFullResponse: true })
|
||||
// Validate etag
|
||||
t.regex(etag, /W\/".*"$/)
|
||||
// Verify functionality
|
||||
const error = await t.throws(rp(url('/stateless'), { headers: { 'If-None-Match': etag } }))
|
||||
t.is(error.statusCode, 304)
|
||||
|
Loading…
Reference in New Issue
Block a user