|
4 | 4 | import org.slf4j.LoggerFactory; |
5 | 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
6 | 6 | import org.springframework.context.event.ContextRefreshedEvent; |
| 7 | +import org.springframework.http.HttpEntity; |
| 8 | +import org.springframework.http.HttpHeaders; |
| 9 | +import org.springframework.http.MediaType; |
7 | 10 | import org.springframework.http.ResponseEntity; |
8 | 11 | import org.springframework.scheduling.annotation.Scheduled; |
9 | 12 | import org.springframework.stereotype.Component; |
@@ -61,7 +64,58 @@ public void warmUpEndpoints() { |
61 | 64 | String url = baseUrl + pattern; |
62 | 65 | try { |
63 | 66 | logger.debug("Warming up endpoint: {} {}", RequestMethod.POST, url); |
64 | | - ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); |
| 67 | + // POST 요청을 위한 빈 요청 본문 생성 |
| 68 | + HttpHeaders headers = new HttpHeaders(); |
| 69 | + headers.setContentType(MediaType.APPLICATION_JSON); |
| 70 | + |
| 71 | + String requestBody = """ |
| 72 | + { |
| 73 | + "intent": { |
| 74 | + "id": "yvm1dtgi7nym54z0aaid71pl", |
| 75 | + "name": "블록 이름" |
| 76 | + }, |
| 77 | + "userRequest": { |
| 78 | + "timezone": "Asia/Seoul", |
| 79 | + "params": { |
| 80 | + "ignoreMe": "true" |
| 81 | + }, |
| 82 | + "block": { |
| 83 | + "id": "yvm1dtgi7nym54z0aaid71pl", |
| 84 | + "name": "블록 이름" |
| 85 | + }, |
| 86 | + "utterance": "발화 내용", |
| 87 | + "lang": null, |
| 88 | + "user": { |
| 89 | + "id": "74f7e7ab2bf19e63bb1ec845b760631259d7615440a2d3db7b344ac48ed1bbcde5", |
| 90 | + "type": "accountId", |
| 91 | + "properties": {} |
| 92 | + } |
| 93 | + }, |
| 94 | + "bot": { |
| 95 | + "id": "65e8142d0a73415ce0694943", |
| 96 | + "name": "봇 이름" |
| 97 | + }, |
| 98 | + "action": { |
| 99 | + "name": "g7e6t8yqcr", |
| 100 | + "clientExtra": { |
| 101 | + "sys_campus_id": "1" |
| 102 | + }, |
| 103 | + "params": { |
| 104 | + "sys_date": "오늘", |
| 105 | + "sys_cafeteria_name": "아람관" |
| 106 | + }, |
| 107 | + "id": "yvy3cqsh14brsvm9uf55cktv", |
| 108 | + "detailParams": { |
| 109 | + "sys_cafeteria_name": { |
| 110 | + "origin": "아람관" |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | + }"""; |
| 115 | + |
| 116 | + HttpEntity<String> request = new HttpEntity<>(requestBody, headers); |
| 117 | + |
| 118 | + ResponseEntity<String> response = restTemplate.postForEntity(url, request, String.class); |
65 | 119 | logger.debug("Warm-up response status: {}", response.getStatusCode()); |
66 | 120 | } catch (Exception e) { |
67 | 121 | logger.warn("Failed to warm up endpoint: {} - {}", url, e.getMessage()); |
|
0 commit comments