mirror of
https://github.com/fmhy/edit.git
synced 2025-07-29 23:32:17 +10:00
18 lines
499 B
TypeScript
18 lines
499 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const env = useRuntimeConfig(event)
|
|
const data = await event.web.request.json()
|
|
|
|
console.info(data)
|
|
const forwardHeaders = new Headers(data.headers)
|
|
forwardHeaders.delete('cookie')
|
|
|
|
const upstreamResp = await fetch(`${env.ANALYTICS_DOMAIN}/api/event`, {
|
|
method: 'POST',
|
|
body: JSON.stringify(data),
|
|
headers: forwardHeaders
|
|
})
|
|
|
|
console.info(upstreamResp)
|
|
|
|
return new Response(null, { status: upstreamResp.status })
|
|
})
|