Django REST Framework: Exception: Unsupported media type 'application/pdf' in request

I'm using django to upload a file without using model or template or serializer.Django views are being used to upload a file to a third-party server. "UnsupportedMediaType: Unsupported media type "image/gif" in request" is the exception. I'm using Postman to hit a POST request with a binary body(file). When debugger comes to line file =request.FILE['file'], it throws exception "UnsupportedMediaType: Unsupported media type "image/gif" in request" . API View:

def upload_document(request):
    acct_id = request.query_params.get('client_acct_id')
    doc_type = request.query_params.get('doc_type')
    file = request.FILE['file']```
Back to Top