Skip to content

Commit

Permalink
Fix: (BRD-73) 회원가입 성공 상태코드 변경(200 OK -> 201 CREATED)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttasjwi committed Nov 15, 2024
1 parent 1623441 commit df52634
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.ttasjwi.board.system.core.message.MessageResolver
import com.ttasjwi.board.system.member.application.usecase.RegisterMemberRequest
import com.ttasjwi.board.system.member.application.usecase.RegisterMemberResult
import com.ttasjwi.board.system.member.application.usecase.RegisterMemberUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
Expand All @@ -27,8 +28,8 @@ class RegisterMemberController(
// 처리 결과로부터 응답 메시지 가공
val response = makeResponse(result)

// 200 상태코드와 함께 HTTP 응답
return ResponseEntity.ok(response)
// 201 상태코드와 함께 HTTP 응답
return ResponseEntity.status(HttpStatus.CREATED).body(response)
}

private fun makeResponse(result: RegisterMemberResult): SuccessResponse<RegisterMemberResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RegisterMemberControllerTest {
val response = responseEntity.body as SuccessResponse<RegisterMemberResponse>

// then
assertThat(responseEntity.statusCode.value()).isEqualTo(HttpStatus.OK.value())
assertThat(responseEntity.statusCode.value()).isEqualTo(HttpStatus.CREATED.value())
assertThat(response.isSuccess).isTrue()
assertThat(response.code).isEqualTo("RegisterMember.Complete")
assertThat(response.message).isEqualTo("RegisterMember.Complete.message(locale=${Locale.KOREAN},args=[])")
Expand Down

0 comments on commit df52634

Please sign in to comment.