Skip to content

Commit

Permalink
MediaType.get(s) -> s.toMediaType()
Browse files Browse the repository at this point in the history
OkHttp 4 moves MediaType.get to toMediaType (an extension function)
See: https://square.github.io/okhttp/changelogs/upgrading_to_okhttp_4/
  • Loading branch information
chromy committed May 9, 2024
1 parent c72caa1 commit 4cec519
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.emergetools.hackernews.network
import com.emergetools.hackernews.network.models.Item
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import kotlinx.serialization.json.Json
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaType
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Path
Expand All @@ -12,7 +12,7 @@ private const val HN_BASE_URL = "https://hacker-news.firebaseio.com/v0/"

private val retrofit = Retrofit.Builder()
.baseUrl(HN_BASE_URL)
.addConverterFactory(Json.asConverterFactory(MediaType.get("application/json")))
.addConverterFactory(Json.asConverterFactory("application/json".toMediaType()))
.build()

interface HNApiService {
Expand Down

0 comments on commit 4cec519

Please sign in to comment.