회원탈퇴는 Put일까 Delete일까?

Alex·2025년 3월 4일
0

CS를 공부하자

목록 보기
40/74

이 고민을 하게 된 이유는
소프트딜리트처럼 회원탈퇴 시점에 유저 데이터를 삭제하지 않을 경우
실질적으로 리소스를 지우는 게 아니지 않나? 하는 의문이 들었기 때문이다.

이에 대해 찾아보니

소프트 삭제 하는경우 HTTP request method 뭐 쓰시나요? (DELETE vs. PUT vs. POST)

소프트딜리트를 해서 데이터를 변경하는 식으로 처리한다는 건
DB의 관심사이고 클라이언트에서는 이를 알 필요가 없다는 내용이 있었다.
REST는 확장성이 중요하다. 어떤 클라이언트간에 서버와 요청-응답을 주고 받을 수 있다는 것이 중요하다.

그래서, DB의 관심사가 클라이언트를 고려하는 게 맞지 않다고 생각이 든다. 이제 다시 그 회원을 호출하면 404 Not Found만 뜨도록 조치를 하면 된다.

RFC-2616에서 Delete 메서드를 설명한 내용을 보면

The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.

it intends to delete the resource or move it to an inaccessible location.

접근할 수 없는 장소로 이동시키고 응답을 404로 보내는 경우도 Delete가 적합한 것으로 보인다.

profile
답을 찾기 위해서 노력하는 사람

0개의 댓글