Merge branch 'dev' into integrasi_sso

This commit is contained in:
ari
2025-12-12 14:03:29 +07:00
634 changed files with 34053 additions and 5878 deletions
+4 -8
View File
@@ -1,21 +1,17 @@
import { defineEventHandler, getCookie, getRequestHeaders, getRequestURL, readBody } from 'h3'
export default defineEventHandler(async (event) => {
const { method } = event.node.req
const { method } = event.node.req as any
const headers = getRequestHeaders(event)
const url = getRequestURL(event)
const config = useRuntimeConfig()
const apiOrigin = config.public.API_ORIGIN
const apiVclaim = config.public.VCLAIM
const apiVclaimSwagger = config.public.VCLAIM_SWAGGER
const pathname = url.pathname.replace(/^\/api/, '')
const isVclaim = pathname.includes('/vclaim')
const isVclaim = pathname.includes('/vclaim') && !pathname.includes('/vclaim-sep')
let targetUrl = apiOrigin + pathname + (url.search || '')
if (pathname.includes('/vclaim')) {
targetUrl = apiVclaim + pathname.replace('/vclaim', '') + (url.search || '')
}
if (pathname.includes('/vclaim-swagger')) {
targetUrl = apiVclaimSwagger + pathname.replace('/vclaim-swagger', '') + (url.search || '')
}
@@ -36,9 +32,9 @@ export default defineEventHandler(async (event) => {
}
let body: any
if (['POST', 'PATCH'].includes(method!)) {
if (['POST', 'PATCH', 'PUT', 'DELETE'].includes(method)) {
if (headers['content-type']?.includes('multipart/form-data')) {
body = await readBody(event)
body = await readRawBody(event, false) // false to get Buffer
} else {
body = await readBody(event)
forwardHeaders.set('Content-Type', 'application/json')