Skip to content

Commit

Permalink
fix: useRequestEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 2, 2022
1 parent 856d26d commit 48e86ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/runtime/pages/document-driven.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { useNuxtApp, useContent, useContentHead } from '#imports'
import { useContent, useContentHead, useRequestEvent } from '#imports'
const { page } = useContent()
// Page not found, set correct status code on SSR
const nuxtApp = useNuxtApp()
if (!page.value && process.server && nuxtApp.ssrContext) {
nuxtApp.ssrContext.res.statusCode = 404
if (!page.value && process.server) {
const event = useRequestEvent()
event.res.statusCode = 404
}
useContentHead(page)
Expand Down
2 changes: 1 addition & 1 deletion test/document-driven.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('fixtures:document-driven', async () => {
await $fetch('/page-not-found')
} catch (e) {
expect(e.response.status).toBe(404)
expect(e.response.statusText).toBe('Not found')
expect(e.response.statusText).toBe('Not Found')
}
})
})

0 comments on commit 48e86ae

Please sign in to comment.