mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #929] Support downloading binary responses #330
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
http://tim.org/images/TIMtitle.GIFas the request URLExpected 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
Desktop:
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 BDbyte triplets. Its size is also 2-3 times bigger than that of the original file.@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 fortext/jsonformats.Need to redo how to handle binary files 👍
@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.
@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.
@AndrewBastin commented on GitHub (Jun 10, 2020):
Okay, I will work on the PR to temporarily disable that.
@AndrewBastin commented on GitHub (Jun 10, 2020):
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.