How can I return a JSON response and a file response:
Right now I do this:
runNumber = "A0001"
response = None
try:
response = make_response("Line One\r\nLine Two\r\n")
response.headers["Content-Disposition"] = "attachment; filename=" + runNumber + ".txt"
except MyCustomException as e:
response = jsonify(error=e.value, runnumber=runNumber)
except:
raise
return(response)
But that only allows me to return JSON OR a File. In some cases, I want to return both.
[edit:] The case where I want to return JSON and a file is when there is a warning about the file contents that the user should check before using the file.
If this is not possible, I will add the warning to the contents of the file.