Content-Disposition header Azure HTTP trigger function

1.1k Views Asked by At

Basically iam trying to get an excel as a response from an HTTP triggered azure function

response = func.HttpResponse(data, mimetype='application/vnd.ms-excel')
response['Content-Disposition'] = 'attachment; filename="test.xlsx"'
return response

but there is no header for Content -Disposition

1

There are 1 best solutions below

1
On BEST ANSWER

Please try to use this code:

response = func.HttpResponse(fileContent, headers={'Content-Disposition':'attachment; filename="test.xlsx"'}, mimetype='application/vnd.ms-excel')