jojoldu / freelec-springboot2-webservice

1.07k stars 464 forks source link

[오류] p.115 #908

Closed alswns1201 closed 4 months ago

alswns1201 commented 4 months ago

어떤 오류인가요?

오류설명: PUT 수정 TEST 중에 오류입니다 . ResponseEntity responseEntity = restTemplate.exchange(url,HttpMethod.PUT,requestEntity,Long.class); Error while extracting response for type [class java.lang.Long] and content type [application/json];

프로젝트 주소

Github에 오류가 난 프로젝트를 올려주세요.
Github 주소를 작성해주지 않으시면 답변해드릴수가 없어요!

오류 로그

image

Gomdollee commented 4 months ago

저도 똑같은 오류납니다 ㅠㅠ

Gomdollee commented 4 months ago

저는 해결하긴했는데 Controller 쪽에서 PathVariable에 name을 지정해줬습니다 @PutMapping("posts/{id}") public Long update(@PathVariable(name = "id") Long id, @RequestBody PostsUpdateRequestDto requestDto){ return postsService.update(id, requestDto); } 이런식으로요 혹시나해서 댓글 남겨드립니다!

linxizhu1209 commented 4 months ago

저는 해결하긴했는데 Controller 쪽에서 PathVariable에 name을 지정해줬습니다 @PutMapping("posts/{id}") public Long update(@PathVariable(name = "id") Long id, @requestbody PostsUpdateRequestDto requestDto){ return postsService.update(id, requestDto); } 이런식으로요 혹시나해서 댓글 남겨드립니다!

저도 name="id" 붙였더니 오류해결됐습니다!! 감사합니다

alswns1201 commented 4 months ago

저도 해결 했습니다 저는 url /api/v1/posts 관련하여 오타가 있었습니다.