diff --git a/src/main/kotlin/com/example/daitssuapi/common/exception/ExceptionHandler.kt b/src/main/kotlin/com/example/daitssuapi/common/exception/ExceptionHandler.kt index e227f3b3..8349b0c5 100644 --- a/src/main/kotlin/com/example/daitssuapi/common/exception/ExceptionHandler.kt +++ b/src/main/kotlin/com/example/daitssuapi/common/exception/ExceptionHandler.kt @@ -31,7 +31,7 @@ class ExceptionHandler() { """ { "request" : $requestInfo, - "code" : "${exception.errorCode}", + "code" : "${exception.errorCode.code}", "message" : "${exception.errorCode.message}", "status" : "$httpStatus" } diff --git a/src/main/kotlin/com/example/daitssuapi/common/filter/RequestLoggingFilter.kt b/src/main/kotlin/com/example/daitssuapi/common/filter/RequestLoggingFilter.kt index a539ea3c..8d26a411 100644 --- a/src/main/kotlin/com/example/daitssuapi/common/filter/RequestLoggingFilter.kt +++ b/src/main/kotlin/com/example/daitssuapi/common/filter/RequestLoggingFilter.kt @@ -31,6 +31,7 @@ class RequestLoggingFilter : OncePerRequestFilter() { filterChain.doFilter(wrappedRequest, wrappedResponse) + wrappedResponse.copyBodyToResponse() if (!(request.getAttribute("isLogged") as Boolean)) { val requestInfo = makeRequestInfo(wrappedRequest) val responseInfo = makeResponseInfo(wrappedResponse) diff --git a/src/main/kotlin/com/example/daitssuapi/domain/main/controller/ArticleController.kt b/src/main/kotlin/com/example/daitssuapi/domain/main/controller/ArticleController.kt index 31a87fc5..0ffef119 100644 --- a/src/main/kotlin/com/example/daitssuapi/domain/main/controller/ArticleController.kt +++ b/src/main/kotlin/com/example/daitssuapi/domain/main/controller/ArticleController.kt @@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.web.bind.annotation.* @RestController -@RequestMapping("/daitssu/community/article") +@RequestMapping("/community/article") @Tag(name = "article", description = "커뮤니티 게시글 API") class ArticleController( private val articleService: ArticleService @@ -46,4 +46,4 @@ class ArticleController( @RequestBody articleWriteRequest: ArticleWriteRequest ): Response = Response(data = articleService.writeArticle(articleWriteRequest)) -} \ No newline at end of file +} diff --git a/src/test/kotlin/com/example/daitssuapi/domain/main/controller/ArticleControllerTest.kt b/src/test/kotlin/com/example/daitssuapi/domain/main/controller/ArticleControllerTest.kt index e5e1ea54..da9997fa 100644 --- a/src/test/kotlin/com/example/daitssuapi/domain/main/controller/ArticleControllerTest.kt +++ b/src/test/kotlin/com/example/daitssuapi/domain/main/controller/ArticleControllerTest.kt @@ -61,7 +61,7 @@ class ArticleControllerTest( @DisplayName("article get controller test") fun article_get_controller_test() { // given - val baseUri = "/daitssu/community/article" + val baseUri = "/community/article" val user = userRepository.findAll()[0] val article: Article = Article( topic = Topic.CHAT, @@ -87,7 +87,7 @@ class ArticleControllerTest( @DisplayName("article post 성공") fun article_post_controller_success() { // given - val baseUri = "/daitssu/community/article" + val baseUri = "/community/article" val user = userRepository.findAll()[0] val articleWriteRequest = ArticleWriteRequest( topic = Topic.CHAT, @@ -116,7 +116,7 @@ class ArticleControllerTest( @DisplayName("article post nickname null") fun article_post_nickname_null() { // given - val baseUri = "/daitssu/community/article" + val baseUri = "/community/article" val articleWriteRequest = ArticleWriteRequest( topic = Topic.CHAT, title = "테스트 제목", @@ -135,4 +135,4 @@ class ArticleControllerTest( ).andExpect(jsonPath("$.code").value(ErrorCode.NICKNAME_REQUIRED.code)) .andExpect(jsonPath("$.message").value(ErrorCode.NICKNAME_REQUIRED.message)) } -} \ No newline at end of file +} diff --git a/src/test/resources/application-local.yml b/src/test/resources/application.yml similarity index 90% rename from src/test/resources/application-local.yml rename to src/test/resources/application.yml index d57b3bd4..dbd1c375 100644 --- a/src/test/resources/application-local.yml +++ b/src/test/resources/application.yml @@ -20,4 +20,4 @@ spring: sql: init: schema-locations: classpath:/schema.sql - data-locations: classpath:/data.sql +# data-locations: classpath:/data.sql diff --git a/src/test/resources/data.sql b/src/test/resources/data.sql deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/schema.sql b/src/test/resources/schema.sql index f3606527..fa84de30 100644 --- a/src/test/resources/schema.sql +++ b/src/test/resources/schema.sql @@ -1,3 +1,3 @@ -CREATE SCHEMA main; -CREATE SCHEMA notice; -CREATE SCHEMA course; +CREATE SCHEMA IF NOT EXISTS main; +CREATE SCHEMA IF NOT EXISTS notice; +CREATE SCHEMA IF NOT EXISTS course;