Skip to content

Commit

Permalink
fix(#76-support-search): remove default request headers
Browse files Browse the repository at this point in the history
  • Loading branch information
y9Kap committed Oct 31, 2023
1 parent d219205 commit 491d3a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import io.ktor.client.call.*
import io.ktor.client.plugins.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.plugins.websocket.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.utils.io.errors.*
import io.rsocket.kotlin.ktor.client.RSocketSupport
import kotlinx.coroutines.CancellationException
Expand All @@ -51,9 +49,6 @@ public class KtorMeetacyEngine(
ignoreUnknownKeys = true
}
}
defaultRequest {
header(HttpHeaders.ContentType, ContentType.Application.Json.toString())
}
}

private val auth = AuthEngine(baseUrl, this.httpClient)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import kotlinx.serialization.json.put
internal class FriendsEngine(
baseUrl: Url,
private val httpClient: HttpClient,
val json: Json
private val json: Json
) {
private val baseUrl = baseUrl / "friends"

Expand Down Expand Up @@ -149,14 +149,14 @@ private fun Location.encodeToPayload(): Payload = buildPayload {
}

@Serializable
private data class ModelUserLocationSnapshotSerializable(
private data class UserLocationSnapshotSerializable(
val user: UserSerializable,
val location: LocationSerializable,
val capturedAt: String
)

private fun Payload.decodeToUserLocationSnapshot(json: Json): UserLocationSnapshot {
val deserialized = json.decodeFromString<ModelUserLocationSnapshotSerializable>(data.readText())
val deserialized = json.decodeFromString<UserLocationSnapshotSerializable>(data.readText())

return UserLocationSnapshot(
user = deserialized.user.type() as RegularUser,
Expand Down

0 comments on commit 491d3a5

Please sign in to comment.