Skip to content

Commit 838dca4

Browse files
authored
[BACKEND] 호환성 체크 API 응답 형식 개선 (#110)
## #️⃣연관된 이슈 > ex) #이슈번호, #이슈번호 ## 📝작업 내용 > 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능) ### 스크린샷 (선택) ## 💬리뷰 요구사항(선택) > 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 > > ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?
1 parent c2bcb30 commit 838dca4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

backend/src/main/java/com/cmg/comtogether/common/exception/ErrorCode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public enum ErrorCode {
3333
// Gemini API
3434
GEMINI_API_ERROR(502, "GEMINI-999", "Gemini API와 통신 중 오류가 발생했습니다."),
3535

36-
3736
// 가이드
3837
GUIDE_NOT_FOUND(404, "GUIDE-001", "가이드를 찾을 수 없습니다"),
3938

backend/src/main/java/com/cmg/comtogether/compatibility/controller/CompatibilityController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ public ResponseEntity<SseEmitter> checkCompatibility(
6363
Thread.currentThread().getName()
6464
);
6565

66-
// JSON을 포맷팅하여 가독성 향상
67-
String formattedJson = objectMapper.writerWithDefaultPrettyPrinter()
68-
.writeValueAsString(result);
66+
// SSE 특성상 줄바꿈이 있으면 data: 라인이 여러 줄로 쪼개지므로
67+
// 한 줄짜리 JSON 문자열로 전송하고, 프론트에서 필요하면 pretty print 처리
68+
String json = objectMapper.writeValueAsString(result);
6969

70-
// 각 검사 항목 완료 시 SSE로 전송 (포맷팅된 JSON 사용)
70+
// 각 검사 항목 완료 시 SSE로 전송 (단일 라인 JSON)
7171
emitter.send(SseEmitter.event()
7272
.name("result")
73-
.data(formattedJson));
73+
.data(json));
7474
} catch (IOException e) {
7575
log.error("SSE 전송 실패", e);
7676
emitter.completeWithError(e);

0 commit comments

Comments
 (0)