Skip to content

Commit

Permalink
okhttp fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyofrancis committed Aug 17, 2020
1 parent 612f8d5 commit baf9311
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ open class OkHttpDownloader @JvmOverloads constructor(
.build()
}
var okHttpResponse = client.newCall(okHttpRequest).execute()
var responseHeaders = okHttpResponse.headers().toMultimap()
var code = okHttpResponse.code()
var responseHeaders = okHttpResponse.headers.toMultimap()
var code = okHttpResponse.code
if ((code == HttpURLConnection.HTTP_MOVED_TEMP
|| code == HttpURLConnection.HTTP_MOVED_PERM
|| code == HttpURLConnection.HTTP_SEE_OTHER) && getHeaderValue(responseHeaders, "Location") != null) {
Expand All @@ -88,20 +88,20 @@ open class OkHttpDownloader @JvmOverloads constructor(
.build()
}
okHttpResponse = client.newCall(okHttpRequest).execute()
responseHeaders = okHttpResponse.headers().toMultimap()
code = okHttpResponse.code()
responseHeaders = okHttpResponse.headers.toMultimap()
code = okHttpResponse.code
}

val success = okHttpResponse.isSuccessful
val contentLength = getContentLengthFromHeader(responseHeaders, -1L)
val byteStream: InputStream? = okHttpResponse.body()?.byteStream()
val byteStream: InputStream? = okHttpResponse.body?.byteStream()
val errorResponseString: String? = if (!success) {
copyStreamToString(byteStream, false)
} else {
null
}

val hash = getContentHash(responseHeaders)
val hash = getContentHash(responseHeaders.toMutableMap())

val acceptsRanges = acceptRanges(code, responseHeaders)

Expand Down

0 comments on commit baf9311

Please sign in to comment.