itkacher/OkHttpProfiler

Uploading Video

Closed this issue · 2 comments

I like the profile very much. But when I post a bigger file like a Video to my backend and I click on the line the POST in the profile-window my system starts to hang.
For now I try to avoid to click on a line with a big POST... but is there a better solution?

Same issue here. Here's the code that causes AS to hang until hard restarted:

Call

@POST("/path/video")
@Headers("Content-Type: video/mp4")
fun uploadVideoFile(
  @Header(MY_HEADER_1) header1: String,
  @Header(MY_HEADER_2) header2: String,
  @Body videoRequestBody: RequestBody
) : Call<VideoUploadResponse?>

Reading video file

val file = File(videoPath)
val videoByteArray = ByteArray(file.length().toInt())
val buf = BufferedInputStream(FileInputStream(file))
try {
  buf.read(videoByteArray, 0, videoByteArray.size)
} catch (e: IOException) {
  e.printStackTrace()
} finally {
  buf.close()
}

val videoRequestBody = RequestBody.create(MediaType.parse("Content-Type: video/mp4"), videoByteArray)

I added a limit to the version 1.0.15
Improved a lot the speed of the plugin.
Will be available in the market in a few days, or you can download and install it there:
https://plugins.jetbrains.com/plugin/11249-okhttp-profiler/versions/stable/104572

P.S. It's better to fix later, than never :)