Skip to content

Commit a9d5076

Browse files
committed
Use new Api Endpoint
1 parent 2439ca4 commit a9d5076

File tree

1 file changed

+3
-1
lines changed
  • feature/metis/conversation/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/conversation/service/network/impl

1 file changed

+3
-1
lines changed

feature/metis/conversation/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/conversation/service/network/impl/MetisServiceImpl.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package de.tum.informatics.www1.artemis.native_app.feature.metis.conversation.se
33
import de.tum.informatics.www1.artemis.native_app.core.data.NetworkResponse
44
import de.tum.informatics.www1.artemis.native_app.core.data.cookieAuth
55
import de.tum.informatics.www1.artemis.native_app.core.data.performNetworkCall
6+
import de.tum.informatics.www1.artemis.native_app.core.data.service.Api
67
import de.tum.informatics.www1.artemis.native_app.core.data.service.KtorProvider
78
import de.tum.informatics.www1.artemis.native_app.feature.metis.conversation.service.model.LinkPreview
89
import de.tum.informatics.www1.artemis.native_app.feature.metis.conversation.service.network.MetisService
@@ -162,12 +163,13 @@ internal class MetisServiceImpl(
162163
runCatching {
163164
val response: JsonObject = ktorProvider.ktorClient.get(serverUrl) {
164165
url {
165-
appendPathSegments("api", "link-preview")
166+
appendPathSegments(*Api.Communication.path, "link-preview")
166167
}
167168
parameter("url", url)
168169
cookieAuth(authToken)
169170
}.body()
170171

172+
// For some reason, the server sometimes returns an empty response.
171173
if (response.jsonObject.isEmpty()) null
172174
else json.decodeFromJsonElement(LinkPreview.serializer(), response)
173175
}.getOrNull()

0 commit comments

Comments
 (0)