(@PathVariable Integer cno, @RequestBody CommentDto dto)
| 25 | // } |
| 26 | // 댓글을 수정하는 메서드 |
| 27 | @PatchMapping("/comments/{cno}") // /ch4/comments/26 PATCH |
| 28 | public ResponseEntity<String> modify(@PathVariable Integer cno, @RequestBody CommentDto dto) { |
| 29 | // String commenter = (String)session.getAttribute("id"); |
| 30 | String commenter = "asdf"; |
| 31 | dto.setCommenter(commenter); |
| 32 | dto.setCno(cno); |
| 33 | System.out.println("dto = " + dto); |
| 34 | |
| 35 | try { |
| 36 | if(service.modify(dto)!=1) |
| 37 | throw new Exception("Write failed."); |
| 38 | |
| 39 | return new ResponseEntity<>("MOD_OK", HttpStatus.OK); |
| 40 | } catch (Exception e) { |
| 41 | e.printStackTrace(); |
| 42 | return new ResponseEntity<String>("MOD_ERR", HttpStatus.BAD_REQUEST); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // { |
| 47 | // "pcno":0, |
nothing calls this directly
no test coverage detected