Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema generation HTTPresponse #330

Closed
josephbiko opened this issue Mar 13, 2019 · 1 comment
Closed

Schema generation HTTPresponse #330

josephbiko opened this issue Mar 13, 2019 · 1 comment
Labels
question Open question

Comments

@josephbiko
Copy link

I have a view that returns a httpresponse with a file.

def retrieve_file(self,request,*args,**kwargs):      
        media =self.get_object()
        response = HttpResponse()
        response['Content-Type'] = media.mime_type
        response['X-Accel-Redirect'] = media.file.path
        response['Content-Disposition'] = f'form-data; name="{media.filename}";filename="{media.filename}"'
        return response

As this is not using a serializer, and auto_schema does not support httpresponses, how do I generate a schema for this?

Kind regards

@axnsan12
Copy link
Owner

axnsan12 commented Apr 1, 2019

This is not possible. Use a serializer or annotate with response_body or manual_parameters.

@axnsan12 axnsan12 closed this as completed Apr 1, 2019
@axnsan12 axnsan12 added the question Open question label Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Open question
Projects
None yet
Development

No branches or pull requests

2 participants