Complete the code to set a cookie named 'sessionId' with value 'abc123'.
response.headers.set('Set-Cookie', 'sessionId=[1]; Path=/; HttpOnly')
The cookie value must be 'abc123' to correctly set the session ID.
Complete the code to read the 'sessionId' cookie from the request headers.
const cookies = request.headers.get('cookie') || ''; const sessionId = cookies.split('; ').find(c => c.startsWith('[1]='))?.split('=')[1];
The cookie name to find is 'sessionId' to get the correct session value.
Fix the error in the code to correctly clear the 'sessionId' cookie.
response.headers.set('Set-Cookie', 'sessionId=[1]; Path=/; HttpOnly; Max-Age=0')
Setting the cookie value to an empty string '' with Max-Age=0 clears the cookie.
Fill both blanks to create a cookie with 'Secure' and 'SameSite=Strict' attributes.
response.headers.set('Set-Cookie', 'sessionId=abc123; Path=/; [1]; [2]')
Adding 'Secure' ensures cookie is sent over HTTPS only, and 'SameSite=Strict' prevents cross-site sending.
Fill all three blanks to create a cookie with a dynamic session ID, HttpOnly, and a 1-hour expiry.
response.headers.set('Set-Cookie', 'sessionId=[1]; Path=/; [2]; [3]')
The session ID is dynamic from 'userSession.id', with 'HttpOnly' for security and 'Max-Age=3600' for 1-hour expiry.
