Skip to content

Commit

Permalink
Merge pull request #238 from hyeeyoung/dev-mod-item-parsing-response
Browse files Browse the repository at this point in the history
[mod] data: {} 인 경우 204로 보내도록 수정
  • Loading branch information
hyejungg authored Dec 13, 2022
2 parents a963e81 + 552e29a commit af3b214
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/controllers/itemController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const {
} = require('../utils/response');
const { Strings } = require('../utils/strings');

const existEmptyData = (obj) => {
if (obj.constructor !== Object) {
return false;
}
if (JSON.stringify(obj) !== '{}') {
return false;
}
return true;
};

module.exports = {
insertItemInfo: async function (req, res, next) {
try {
Expand Down Expand Up @@ -171,7 +181,10 @@ module.exports = {
}
await onBindParsingType(req.query.site)
.then((data) => {
res.status(StatusCode.OK).json({
if (existEmptyData(data)) {
return res.status(StatusCode.NOCONTENT).json();
}
return res.status(StatusCode.OK).json({
success: true,
message: SuccessMessage.itemParse,
data,
Expand Down

0 comments on commit af3b214

Please sign in to comment.