Skip to content

Commit

Permalink
ev-service에서 body가 비어 있는 경우 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
asp345 committed Jan 27, 2025
1 parent 5f11dc6 commit a330efa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/kotlin/evaluation/service/EvService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.wafflestudio.snu4t.evaluation.dto.EvUserDto
import com.wafflestudio.snu4t.timetables.service.TimetableService
import com.wafflestudio.snu4t.users.service.UserService
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlinx.coroutines.reactor.awaitSingle
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
Expand All @@ -35,8 +36,8 @@ class EvService(
requestQueryParams: MultiValueMap<String, String> = buildMultiValueMap(mapOf()),
originalBody: String,
method: HttpMethod,
): Map<String, Any?> {
val result: MutableMap<String, Any?> =
): Map<String, Any?>? {
val result: MutableMap<String, Any?>? =
snuttEvWebClient.method(method)
.uri { builder -> builder.path(requestPath).queryParams(requestQueryParams).build() }
.header("Snutt-User-Id", userId)
Expand All @@ -51,7 +52,7 @@ class EvService(
}
}
.bodyToMono<MutableMap<String, Any?>>()
.awaitSingle()
.awaitFirstOrNull()
return updateUserInfo(result)
}

Expand Down Expand Up @@ -98,7 +99,8 @@ class EvService(
}

@Suppress("UNCHECKED_CAST")
private suspend fun updateUserInfo(data: MutableMap<String, Any?>): MutableMap<String, Any?> {
private suspend fun updateUserInfo(data: MutableMap<String, Any?>?): MutableMap<String, Any?>? {
if (data == null) return null
val updatedMap: MutableMap<String, Any?> = mutableMapOf()
for ((k, v) in data.entries) {
if (k == "user_id") {
Expand Down

0 comments on commit a330efa

Please sign in to comment.