Skip to content

Commit

Permalink
Merge pull request #4 from edu-pi/bug/issue3
Browse files Browse the repository at this point in the history
[#3]bug: if 기존 body 존재하는지 확인 로직 추가
  • Loading branch information
ujkkk authored Jan 8, 2025
2 parents c4de804 + f19cfc2 commit 746f3e3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions Code-Analysis-Server/app/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from app.models.request_code import RequestCode
from app.visualize.code_visualizer import CodeVisualizer
from app.web import exception_handler
from app.web.logger import log_request
from app.web.logger import log_request, log_response

app = FastAPI()

# 미들웨어 등록
app.middleware("http")(log_request)
# app.middleware("http")(log_response)
app.middleware("http")(log_response)

# 핸들러 등록
exception_handler.setup_exception_handlers(app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def _append_condition_obj(conditions, elem_container, node: ast.If | ast.stmt):
def _parse_if_body(
node: ast.stmt, conditions: list[ConditionObj], body_objs: list[BodyObj], elem_container: ElementContainer
):
if conditions[-1].result:
if conditions[-1].result and len(body_objs) == 0:
# 조건절의 결과 값이 True이면 해당 body 로직 추가
stmt_objs = StmtTraveler.travel(node.body, elem_container)
body_objs.extend(stmt_objs)
Expand Down
9 changes: 9 additions & 0 deletions Coding-Assist-Server/app/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import JSONResponse

from app.config.settings import Settings
Expand All @@ -25,6 +26,14 @@
)

# 미들웨어 등록
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # 모든 origin 허용 (개발 환경)
allow_credentials=True,
allow_methods=["*"], # 모든 HTTP 메서드 허용
allow_headers=["*"], # 모든 헤더 허용
)

app.middleware("http")(log_request)
if Settings.ENVIRONMENT == "dev":
app.middleware("http")(log_response)
Expand Down

0 comments on commit 746f3e3

Please sign in to comment.