반응형

API 5

[Kotlin] Kotlin DSL + Spring REST Docs + MockMvc 적용기 (2)

kotlin DSL과 Spring REST Docs 세팅을 MockMvc 방법으로 설정하는 포스팅이다. 환경세팅 및 adoc 형식 설정은 지난 포스팅에서 확인할 수 있다. https://kth990303.tistory.com/347 [Kotlin] Kotlin DSL + Spring REST Docs + MockMvc 적용기 (1) 현재(22.07.17.) 는 아직 Spring REST Docs에서 kotlin DSL 공식지원을 하지 않고 있는 상황이다. https://github.com/spring-projects/spring-restdocs/issues/677 Document how to use Spring REST Docs with th.. kth990303.tistory.com 이번 포스팅에선 k..

[Kotlin] Kotlin DSL + Spring REST Docs + MockMvc 적용기 (1)

현재(22.07.17.) 는 아직 Spring REST Docs에서 kotlin DSL 공식지원을 하지 않고 있는 상황이다. https://github.com/spring-projects/spring-restdocs/issues/677 Document how to use Spring REST Docs with the MockMVC Kotlin DSL · Issue #677 · spring-projects/spring-restdocs Was trying to implement RestDocs MockMvc in our Kotlin project However noticed that when using the MockMvc Kotlin DSL snippets were not generated e.g. fun..

[ERROR] Required request body is missing 해결

Required request body is missing 이 에러를 본 적 있는가? 해석해보자면 요청의 body에 존재해야될 것이 존재하지 않는다는 것이다. 보통 400 Bad Request, 415 Unsupported Media Type 에러와 함께 발생할 확률이 높다. 해당 api를 사용할 때 요청에 들어있는 객체를 이용해서 처리하는데, 정작 요청 body에 값이 없는 것이다. 주로 POST, PUT http method API를 사용할 때 많이 발생한다. 해결 방법은 어떻게 될까? 1. (가장 높은 확률로) 요청 body에 담긴 값이 JSON이 아닐 때 400 Bad Request, 415 Unsupported Media Type 에러와 함께 postman을 이용하여 간접적으로 api 호출을 할..

[ERROR] Request method 'GET' not supported 해결

Request method 'GET' not supported 뿐만 아니라 Request method 'GET' not supported, Request method 'PUT' not supported 등등. Request method '{HTTP method}' not supported 관련 에러가 뜰 때 해당되는 포스팅이다. 보통 405 Method Not Allowed, 500 Internal Server Error와 함께 발생할 확률이 높다. 나의 경우는 특정 기능을 수행하거나 테스트할 때 위 문구와 함께 500 에러가 발생했다. 원래대로라면 body에 원하는 객체의 속성들이 담겨있어야 한다. 하지만 결과는? com.fasterxml.jackson.databind.exc.UnrecognizedPr..

[Javascript] fetch 함수로 api를 호출하여 응답을 받아보자

fetch 함수를 이용하면 새로고침 없이 api를 호출하여 http 요청을 보내고 응답을 받아올 수 있다. 이번 포스팅은 스프링으로 개발된 백엔드 코드의 api를 호출하여 json 객체를 fetch 함수를 이용하여 응답을 받아보는 걸 배운 과정을 기록할 것이다. 과정 속에서 내가 발생시킨 어이없는 실수, 멍청한 실수들을 기록해두어, 다음엔 실수하지 않도록 하기 위함이다. 꼭 백엔드 환경이 스프링+자바가 아니더라도 상관없다. 참고로 fetch 공식 문서는 아래 링크에서 확인가능하다. https://ko.javascript.info/fetch fetch ko.javascript.info fetch 함수 - GET 아래와 같은 응답을 보내주는 api가 있다. @GetMapping("/rooms") public..

1
반응형