django-rest-framework-proxy icon indicating copy to clipboard operation
django-rest-framework-proxy copied to clipboard

Unable to proxy binary responses like images

Open vinkobuble opened this issue 6 years ago • 2 comments

We are trying to proxy a third-party image service and we need the proxy library to respond with the raw binary payload it received from the service. Even after setting the 'return_raw' flag, the payload is converted to text before further responding.

It works when I change response.text to response.content on the marked line.

https://github.com/eofs/django-rest-framework-proxy/blob/1fa51b14df364e3dfca3afe57179efefc184d64f/rest_framework_proxy/views.py#L135

vinkobuble avatar May 29 '19 18:05 vinkobuble

It looks like the PR already exists: https://github.com/eofs/django-rest-framework-proxy/pull/30/files

vinkobuble avatar May 29 '19 18:05 vinkobuble

@vinkobuble Yea I created this PR and have been waiting for approval.

vincentwan avatar May 29 '19 18:05 vincentwan