forked from ttc/micro-service-api
-web-service
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { sendResponse } from '../utils/response.js'
|
||||
import { sendError } from '../utils/response.js'
|
||||
|
||||
/**
|
||||
* ✅ Middleware สำหรับตรวจสอบความถูกต้องของ JSON body
|
||||
@@ -7,7 +7,7 @@ import { sendResponse } from '../utils/response.js'
|
||||
export function validateJsonFormat(err, req, res, next) {
|
||||
if (err instanceof SyntaxError && 'body' in err) {
|
||||
console.error('[Invalid JSON Format]', err.message)
|
||||
return sendResponse(res, 400, 'รูปแบบ บอร์ดี้ ไม่ถูกต้อง', 'Invalid Body format')
|
||||
return sendError('รูปแบบ บอร์ดี้ ไม่ถูกต้อง', 'Invalid Body format')
|
||||
}
|
||||
next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user