diff --git a/auth-api/src/auth_api/__init__.py b/auth-api/src/auth_api/__init__.py index 1c35270936..d883098cd0 100644 --- a/auth-api/src/auth_api/__init__.py +++ b/auth-api/src/auth_api/__init__.py @@ -83,7 +83,8 @@ def add_version(response): response.headers['API'] = f'auth_api/{version}' def camelize_json(response): - if response.headers['Content-Type'] == 'application/json': + if (response.headers['Content-Type'] == 'application/json' and + 'swagger.json' not in request.base_url): response.set_data(json.dumps(camelize(json.loads(response.get_data())))) register_shellcontext(app) diff --git a/auth-api/src/auth_api/resources/documents_affidavit.py b/auth-api/src/auth_api/resources/documents_affidavit.py index b4e4a110cd..8008f47935 100644 --- a/auth-api/src/auth_api/resources/documents_affidavit.py +++ b/auth-api/src/auth_api/resources/documents_affidavit.py @@ -45,11 +45,12 @@ def get(): try: doc = DocumentService.fetch_latest_document(DocumentType.AFFIDAVIT.value) if doc is None: - return {'message': 'The requested document could not be found.'}, \ + response, status = {'message': 'The requested document could not be found.'}, \ http_status.HTTP_404_NOT_FOUND - if doc.as_dict().get('content_type', None) == ContentType.PDF.value: # pdfs has to be served as attachment + elif doc.as_dict().get('content_type', None) == ContentType.PDF.value: # pdf has to be served as attachment return send_from_directory('static', filename=doc.as_dict()['content'], as_attachment=True) - + else: + response, status = doc.as_dict(), http_status.HTTP_200_OK except BusinessException as exception: response, status = {'code': exception.code, 'message': exception.message}, exception.status_code return response, status