all: allow unknown keys in responses

This commit is contained in:
Harsh Shandilya 2021-12-15 16:10:41 +05:30
parent b5c2dc9aaf
commit 6eb3acff78
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 12 additions and 3 deletions

View file

@ -38,12 +38,13 @@ object ApiModule {
@Provides
fun provideRetrofit(
client: Lazy<OkHttpClient>,
json: Lazy<Json>,
): Retrofit {
val contentType = "application/json".toMediaType()
return Retrofit.Builder()
.client(client.get())
.baseUrl(LobstersApi.BASE_URL)
.addConverterFactory(Json.asConverterFactory(contentType))
.addConverterFactory(json.get().asConverterFactory(contentType))
.build()
}
@ -51,4 +52,9 @@ object ApiModule {
fun provideApi(retrofit: Retrofit): LobstersApi {
return retrofit.create()
}
@Provides
fun provideJsonSerializer(): Json {
return Json { ignoreUnknownKeys = true }
}
}