Skip to content

Commit

Permalink
fix: Remove deprecated method call in StringConverterFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
haroldadmin committed Jul 27, 2019
1 parent b27634c commit fd8d7d7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.haroldadmin.cnradapter

import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.ResponseBody
import retrofit2.Converter
import retrofit2.Retrofit
Expand All @@ -25,6 +27,6 @@ internal class StringConverterFactory : Converter.Factory() {
methodAnnotations: Array<Annotation>?,
retrofit: Retrofit?
): Converter<*, RequestBody> {
return Converter<String, RequestBody> { value -> RequestBody.create(MediaType.parse("text/plain"), value) }
return Converter<String, RequestBody> { value -> value.toRequestBody("text/plain".toMediaTypeOrNull()) }
}
}

0 comments on commit fd8d7d7

Please sign in to comment.