Skip to content

Commit

Permalink
bug fix for reading streaming wrongly
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyofrancis committed Jan 14, 2019
1 parent 937d542 commit bbeaf09
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ open class OkHttpDownloader @JvmOverloads constructor(
var contentLength = okHttpResponse.body()?.contentLength() ?: -1L
val byteStream: InputStream? = okHttpResponse.body()?.byteStream()
val responseHeaders = mutableMapOf<String, List<String>>()
val errorResponseString: String? = try {
okHttpResponse.body()?.string()
} catch (e: Exception) {
val errorResponseString: String? = if (!success) {
copyStreamToString(byteStream, false)
} else {
null
}
val okResponseHeaders = okHttpResponse.headers()
Expand Down

0 comments on commit bbeaf09

Please sign in to comment.