Issue
Trying to create JSON type header for OkHttp3
val JSONtype = MediaType.parse("application/json; charset=utf-8")
But the following error is coming :
Using 'parse(String):MediaType?' is an error. moved to extension function
Shown solution/suggestion:
val JSONType = "application/json; charset=utf-8".toMediaTypeOrNull()
Do the serve the same action or requirement?
Solution
Yes.
You can check out migration guide:
https://square.github.io/okhttp/upgrading_to_okhttp_4/#extension-functions
Answered By - xinaiz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.