Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResponseStatus를 활용해 주세요 #12

Open
zios0707 opened this issue Aug 23, 2024 · 0 comments
Open

ResponseStatus를 활용해 주세요 #12

zios0707 opened this issue Aug 23, 2024 · 0 comments

Comments

@zios0707
Copy link

zios0707 commented Aug 23, 2024

@PatchMapping("/{account-id}")
public String changeMyInfo(@PathVariable("account-id") String accountId, UserDetailRequest userDetailRequest){
updateUserInfoService.userInfoUpdate(accountId, userDetailRequest);
return "Updated!!";
}

위 코드에서 정보가 성공적으로 변경되면 String으로 성공됐다고 알리는 것 같은데
restful 에서 적절한 응답을 해야되는 특성상 이렇게 되면 안될 것 같아요.

https://ko.wikipedia.org/wiki/HTTP_%EC%83%81%ED%83%9C_%EC%BD%94%EB%93%9C#2xx_(%EC%84%B1%EA%B3%B5)

위 문서를 읽고 적절한 상태 코드를 반환하도록 해주세요.

추가로 아래와 같은 어노테이션을 사용하면 특정 상태코드를 반환하도록 할 수 있어요.

@ResponseStatus(HttpStatus.NO_CONTENT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant