Send Maia requests as JSON over HTTP1
All checks were successful
Deploy Blog Backend / test (push) Successful in 1m20s
Deploy Blog Backend / deploy (push) Successful in 1m24s

This commit is contained in:
박원엽
2026-06-19 16:08:04 +09:00
parent 81d312eb04
commit abb20cfe6d
2 changed files with 9 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration
import org.springframework.http.client.SimpleClientHttpRequestFactory
import org.springframework.web.client.RestClient import org.springframework.web.client.RestClient
import java.time.Duration import java.time.Duration
@@ -16,8 +17,13 @@ class MaiaConfig {
builder: RestClient.Builder, builder: RestClient.Builder,
properties: MaiaProperties properties: MaiaProperties
): RestClient { ): RestClient {
val requestFactory = SimpleClientHttpRequestFactory().apply {
setConnectTimeout(Duration.ofSeconds(5))
setReadTimeout(Duration.ofSeconds(120))
}
return builder return builder
.baseUrl(properties.engineUrl) .baseUrl(properties.engineUrl)
.requestFactory(requestFactory)
.build() .build()
} }
} }

View File

@@ -1,6 +1,7 @@
package me.wypark.blogbackend.domain.chess package me.wypark.blogbackend.domain.chess
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.http.MediaType
import org.springframework.stereotype.Component import org.springframework.stereotype.Component
import org.springframework.web.client.RestClient import org.springframework.web.client.RestClient
import org.springframework.web.client.RestClientException import org.springframework.web.client.RestClientException
@@ -26,6 +27,8 @@ class MaiaEngineClient(
return maiaRestClient return maiaRestClient
.post() .post()
.uri(path) .uri(path)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.body(request) .body(request)
.retrieve() .retrieve()
.body(responseType) .body(responseType)