From bdfe06c849996db12c81ab7dfd054b83509d3769 Mon Sep 17 00:00:00 2001 From: Mike0001-droid Date: Wed, 5 Jun 2024 17:06:38 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=20=D0=B2=D0=BE=D0=B7=D0=B2?= =?UTF-8?q?=D1=80=D0=B0=D1=82=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=B0=D1=83=D0=B4=D0=B8=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/proj/api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/proj/api/views.py b/server/proj/api/views.py index aeaa0f7..81f82cb 100644 --- a/server/proj/api/views.py +++ b/server/proj/api/views.py @@ -24,8 +24,8 @@ class FetchAndServeFile(ViewSet): # Create a response with the appropriate content type and headers file_response = HttpResponse(response.content, content_type='audio/mpeg') file_response['Content-Disposition'] = 'attachment; filename="output.mp3"' - - return file_response + return Response(f'{file_response}', status=status.HTTP_200_OK) + except requests.RequestException as e: return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)