Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions playground/pages/cookie-with-redirect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<p>cookie-with-redirect.vue</p>
</template>

<script setup>
definePageMeta({
middleware: defineNuxtRouteMiddleware(async () => {
useCookie('redirect-test').value = 'foo'

// Immediately redirect during SSR
await navigateTo('/')
})
})
</script>
14 changes: 14 additions & 0 deletions test/bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@
expect(await extractCookie()).toEqual({ foo: 'baz' })
await page.close()
})

it('should respond with set-cookie header even when SSR redirect occurs', async () => {
const res = await fetch('/cookie-with-redirect', { redirect: 'manual' })

// Verify redirect occurred
expect(res.status).toBe(302)
expect(res.headers.get('location')).toEqual('/')

// Verify cookies were set
const cookies = res.headers.get('set-cookie')
expect(cookies).toBeTruthy()

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, dev, vite, transpile, compatibility, esbuild, no-legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, dev, vite, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, vite, transpile, compatibility, esbuild, no-legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, transpile, no-compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, transpile, no-compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, no-transpile, no-compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, dev, webpack, transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, vite, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, dev, webpack, no-transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, dev, webpack, no-transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, no-transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, no-transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, built, webpack, no-transpile, no-compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, no-transpile, no-compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, dev, webpack, transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, dev, webpack, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, no-transpile, no-compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, dev, webpack, no-transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (ubuntu-latest, dev, webpack, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, no-transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, vite, transpile, compatibility, esbuild, no-legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, vite, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, transpile, no-compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, transpile, no-compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, no-transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, built, webpack, transpile, compatibility, isTSX, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, dev, vite, transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, dev, webpack, no-transpile, compatibility, esbuild, legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21

Check failure on line 67 in test/bridge.test.ts

View workflow job for this annotation

GitHub Actions / test-fixtures (windows-latest, dev, vite, transpile, compatibility, esbuild, no-legacy)

test/bridge.test.ts > nuxt composables > should respond with set-cookie header even when SSR redirect occurs

AssertionError: expected null to be truthy - Expected: true + Received: null ❯ test/bridge.test.ts:67:21
expect(cookies).toContain('redirect-test=foo')
})

it('error should be render', async () => {
const html = await $fetch('/async-data')

Expand Down
Loading