Skip to content

Commit 89fcdcc

Browse files
authored
Merge pull request #20 from xebia-functional/19-illegal-character-in-query
Fixed Illegal character error
2 parents cc14aa3 + 26dfdc5 commit 89fcdcc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/kotlin/service/BGGService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import io.ktor.client.engine.cio.*
88
import io.ktor.client.plugins.contentnegotiation.*
99
import io.ktor.client.request.*
1010
import io.ktor.client.statement.*
11+
import io.ktor.http.*
1112
import io.ktor.server.config.*
13+
import java.net.URLEncoder
1214

1315
class BGGService(private val config: ApplicationConfig) {
1416
private val client = HttpClient(CIO) {
@@ -22,8 +24,7 @@ class BGGService(private val config: ApplicationConfig) {
2224
val url = buildString {
2325
append(baseUrl)
2426
append("search?")
25-
append("query=$query")
26-
append("&type=boardgame")
27+
append("query=${URLEncoder.encode(query, "UTF-8")}")
2728
append("&exact=${exact ?: 0}")
2829
}
2930

0 commit comments

Comments
 (0)