mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 16:27:06 +05:30
all: allow unknown keys in responses
This commit is contained in:
parent
b5c2dc9aaf
commit
6eb3acff78
3 changed files with 12 additions and 3 deletions
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue