Direct access to binary content without encoding
rubyshamir opened this issue · 1 comments
Hello and thanks for this great software!
We have a swagger definition containing a "GET" command returning a large file (format: "application/octet-stream").
The current implementation of response() eventually calls "unmarshal_response_inner" in "http_future.py". This method does not have a specific handling for binary data and encodes the data to string.
On large files, like in our case, this is a very time consuming process (2-3 seconds per 0.5 MB).
We have locally altered the code to return the binary data in case of "application/octet-stream" format and the time was reduced to ~0.1 seconds per 0.5 MB.
The altered function is as follows:
def unmarshal_response_inner(response, op):
...
# Code we added ##
if content_type.startswith('application/octet'):
return response.raw_bytes
# TODO: Non-json response contents
return response.text
We will be glad to learn if there is another workaround without changing the code.
Thanks in advance,
Ruby
Duplicated message by mistake