#441 [Fix] 필수 쿼리 파라미터 누락 시 500 대신 400 응답 - #450
Merged
Merged
Conversation
- MissingServletRequestParameterException 이 전역 핸들러의 400 목록에 없어 마지막 Exception 핸들러로 떨어졌다. 필수 파라미터를 빠뜨리면 클라이언트 잘못인데도 COMMON_500 이 나갔다. - 광고 전용 문제가 아니다. 필수 쿼리 파라미터를 쓰는 모든 API 가 함께 영향을 받는다. - 스웨거에서 파라미터를 채우지 않고 Execute 하면 바로 재현된다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
필수 쿼리 파라미터를 빠뜨리면 400 이 아니라 500 이 나갑니다.
GlobalExceptionHandler의 400 목록에MissingServletRequestParameterException이 없어, 마지막Exception핸들러로 떨어집니다.광고 전용 문제가 아닙니다. 필수 쿼리 파라미터를 쓰는 모든 API 가 같은 증상을 갖습니다. 클라이언트 잘못인데 서버 오류로 보고되어, 원인 파악이 그만큼 늦어집니다. 스웨거에서 파라미터를 채우지 않고 Execute 하면 바로 재현됩니다.
변경
MissingServletRequestParameterException을 400 핸들러 목록에 추가한다.GET /api/v1/ads로 회귀 테스트를 건다. 광고 API 는 인증이 없어 이 경로를 검증하기에 가장 단순하다.검증
./gradlew test --tests "com.swyp.picke.domain.ad.*" --tests "com.swyp.picke.global.*" --tests "...AdminAdServiceTest" --rerun-tasks→ BUILD SUCCESSFULAdApiIntegrationTest10건 통과 (failures 0, errors 0)