File size: 643 Bytes
e5400d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { NextRequest, NextResponse } from 'next/server'
import { getAppSession } from 'lib/appSession'

export async function GET(request: NextRequest) {
  try {
    const session = await getAppSession()
    // Echo some headers and cookies for debugging
    const headers: Record<string, string | null> = {
      host: request.headers.get('host'),
      referer: request.headers.get('referer'),
      'user-agent': request.headers.get('user-agent'),
      cookie: request.headers.get('cookie')
    }
    return NextResponse.json({ session, headers })
  } catch (e) {
    return NextResponse.json({ error: String(e) }, { status: 500 })
  }
}