feat: req content-type for upload api

This commit is contained in:
Bobby Wibowo 2022-07-25 06:13:12 +07:00
parent 1b109e0dc0
commit ee8f1914ca
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -199,10 +199,10 @@ self.parseStripTags = stripTags => {
self.upload = async (req, res) => { self.upload = async (req, res) => {
// Assert Request type // Assert Request type
// Multipart for regular uploads, JSON for URL uploads // Multipart for regular uploads, JSON for URL uploads
const isMultipart = req.is('multipart') const isMultipart = req.is('multipart/form-data')
const isJson = req.is('json') const isJson = req.is('application/json')
if (!isMultipart && !isJson) { if (!isMultipart && !isJson) {
throw new ClientError('Request type must be MULTIPART or JSON.') throw new ClientError('Request Content-Type must be either multipart/form-data or application/json.')
} }
let user let user