[GH-ISSUE #929] Support downloading binary responses #330

Closed
opened 2026-03-16 14:43:57 +03:00 by kerem · 5 comments
Owner

Originally created by @pryon on GitHub (Jun 10, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/929

Originally assigned to: @AndrewBastin on GitHub.

Describe the bug
When a binary file (e.g. an image) is requested, the binary content of the response is properly displayed in the response body window, however if the Download file button is clicked, a corrupted blob of data is downloaded instead of the actual binary file that was requested.

To Reproduce
Steps to reproduce the behavior:

  1. Go to postwoman.io
  2. Set http://tim.org/images/TIMtitle.GIF as the request URL
  3. Click Send
  4. When the response has arrived, click on the Download file button above the response body textfield
  5. Examine contents of the downloaded binary file (e.g. with a hex editor), or just try to open the image

Expected behavior
The same binary file gets downloaded that was requested from the remote server.

Screenshots
Hexdumps of the original and postwoman-downloaded image file.
Left: original image file, downloaded via right-click, Save image as...
Right: image file downloaded via postwoman.io

image

Desktop:

  • OS: Windows 10 1909
  • Browser: Chrome
  • Version: 83.0.4103.97

Additional context
When looking at the corrupted file, notice the double-quote in the very beginning and the very end, the unicode-escaped sequences and the occasional new EF BF BD byte triplets. Its size is also 2-3 times bigger than that of the original file.

Originally created by @pryon on GitHub (Jun 10, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/929 Originally assigned to: @AndrewBastin on GitHub. **Describe the bug** When a binary file (e.g. an image) is requested, the binary content of the response is properly displayed in the response body window, however if the **Download file** button is clicked, a corrupted blob of data is downloaded instead of the actual binary file that was requested. **To Reproduce** Steps to reproduce the behavior: 1. Go to postwoman.io 2. Set `http://tim.org/images/TIMtitle.GIF` as the request URL 3. Click **Send** 4. When the response has arrived, click on the **Download file** button above the response body textfield 5. Examine contents of the downloaded binary file (e.g. with a hex editor), or just try to open the image **Expected behavior** The same binary file gets downloaded that was requested from the remote server. **Screenshots** Hexdumps of the original and postwoman-downloaded image file. Left: original image file, downloaded via *right-click, Save image as...* Right: image file downloaded via postwoman.io ![image](https://user-images.githubusercontent.com/12021392/84259358-a68c5180-ab18-11ea-8959-e1f19895b2a8.png) **Desktop:** - OS: Windows 10 1909 - Browser: Chrome - Version: 83.0.4103.97 **Additional context** When looking at the corrupted file, notice the double-quote in the very beginning and the very end, the unicode-escaped sequences and the occasional new `EF BF BD` byte triplets. Its size is also 2-3 times bigger than that of the original file.
kerem 2026-03-16 14:43:57 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@liyasthomas commented on GitHub (Jun 10, 2020):

@pryon Thanks for reporting the issue. We used Blob() for generating binary file to download. Actually it was intented for text/json formats.

Need to redo how to handle binary files 👍

<!-- gh-comment-id:641946123 --> @liyasthomas commented on GitHub (Jun 10, 2020): @pryon Thanks for reporting the issue. We used `Blob()` for generating binary file to download. Actually it was intented for `text/json` formats. Need to redo how to handle binary files :+1:
Author
Owner

@AndrewBastin commented on GitHub (Jun 10, 2020):

@liyasthomas, this is surely something important to be worked on.

I am working on a proposal (once I get the concepts down, I will announce it in the Telegram group for discussion) for a new extensible architecture for handling response bodies of different types, we can manage downloading response files as well in the new architecture.

In the mean time, what about disabling download response option for non-JSON responses ? If you give the green light I will implement a PR to temporarily disable the ability for non-JSON responses to be downloaded.

<!-- gh-comment-id:642301404 --> @AndrewBastin commented on GitHub (Jun 10, 2020): @liyasthomas, this is surely something important to be worked on. I am working on a proposal (once I get the concepts down, I will announce it in the Telegram group for discussion) for a new extensible architecture for handling response bodies of different types, we can manage downloading response files as well in the new architecture. In the mean time, what about disabling download response option for non-JSON responses ? If you give the green light I will implement a PR to temporarily disable the ability for non-JSON responses to be downloaded.
Author
Owner

@liyasthomas commented on GitHub (Jun 10, 2020):

sounds good. I've been trying to convert Blob to array buffer array - but no use. Let's disable download option for binaries for now.

<!-- gh-comment-id:642302547 --> @liyasthomas commented on GitHub (Jun 10, 2020): sounds good. I've been trying to convert Blob to array buffer array - but no use. Let's disable download option for binaries for now.
Author
Owner

@AndrewBastin commented on GitHub (Jun 10, 2020):

Okay, I will work on the PR to temporarily disable that.

<!-- gh-comment-id:642303777 --> @AndrewBastin commented on GitHub (Jun 10, 2020): Okay, I will work on the PR to temporarily disable that.
Author
Owner

@AndrewBastin commented on GitHub (Jun 10, 2020):

sounds good. I've been trying to convert Blob to array buffer array - but no use.

Well, I want separate out the logic from index.vue(i mean, jeez, ~2900 lines) as much as possible as it is getting really huge and complex. So I am working on a new architecture to separate the response handling work to different files.

<!-- gh-comment-id:642304210 --> @AndrewBastin commented on GitHub (Jun 10, 2020): > sounds good. I've been trying to convert Blob to array buffer array - but no use. Well, I want separate out the logic from `index.vue`(i mean, jeez, ~2900 lines) as much as possible as it is getting really huge and complex. So I am working on a new architecture to separate the response handling work to different files.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#330
No description provided.