Content-Disposition header Azure HTTP 触发函数

Content-Disposition header Azure HTTP trigger function

基本上,我试图从 HTTP 触发的 azure 函数

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

但是没有 header Content -Disposition

请尝试使用此代码:

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