Skip to content

Late ktor json plugin installation fails for iOS #1

Description

@libec

Installing the JSON plugin to Ktor HttpClient after it's been initialized doesn't seem to take effect on iOS resulting in parsing failure.

Installing the JSON plugin directly in HttpClient's initializer block works fine:
https://github.com/libec/ynab-kmm-api/blob/f29a2afdb96b15b9a1d2e21dd0a031436db22a52/shared/src/commonMain/kotlin/scopes/Scopes.kt#L52-L60

HttpClient {
    install(ContentNegotiation) {
        json(makeJsonNegotiation())
    }
}

Registering HttpClient in Koin and installing JSON plugin later in NetworkClient's init cases parsing failures on iOS

factory<HttpClient> { HttpClient() }

https://github.com/libec/ynab-kmm-api/blob/f29a2afdb96b15b9a1d2e21dd0a031436db22a52/shared/src/commonMain/kotlin/infrastructure/networking/NetworkClient.kt#L17-L27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions