Skip to content

Commit 9936d8f

Browse files
authored
fix: http response를 200에서 201로 변경 (#12)
1 parent 16d161d commit 9936d8f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/example/base/domain/user/controller/UserController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import com.example.base.domain.user.domain.User;
44
import com.example.base.domain.user.service.UserService;
5-
import lombok.extern.slf4j.Slf4j;
65
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.http.HttpStatus;
7+
import org.springframework.http.ResponseEntity;
78
import org.springframework.web.bind.annotation.GetMapping;
89
import org.springframework.web.bind.annotation.RestController;
910

@@ -17,7 +18,8 @@ public UserController(UserService userService){
1718
}
1819

1920
@GetMapping("/user")
20-
public String createUser(){
21-
return this.userService.createUser(new User()).toString();
21+
public ResponseEntity createUser(){
22+
String userId = this.userService.createUser(new User()).toString();
23+
return new ResponseEntity(userId, HttpStatus.CREATED);
2224
}
2325
}

0 commit comments

Comments
 (0)