python-3.x - Content-Disposition 标头 Azure HTTP 触发函数
问题描述
基本上,我试图从 HTTP 触发的 azure 函数中获取 excel 作为响应
response = func.HttpResponse(data, mimetype='application/vnd.ms-excel')
response['Content-Disposition'] = 'attachment; filename="test.xlsx"'
return response
但没有 Content -Disposition 的标题
解决方案
请尝试使用此代码:
response = func.HttpResponse(fileContent, headers={'Content-Disposition':'attachment; filename="test.xlsx"'}, mimetype='application/vnd.ms-excel')
推荐阅读
- javascript - Javascript 使用 getElementByClassName 更改按钮颜色
- eslintrc - eslint中max-len的配置
- python - 无法使用具有 BigQuery 作业用户角色的服务帐户连接到来自 python 的查询(在 IAM 中)
- javascript - nuxt 项目 onvercel 中的 process.env.URL null
- go - 选择chan,为什么不阻止?但像死循环一样打印
- python - 安装程序应该是本地项目的路径或以 svn+、git+、hg+ 或 bzr+ 开头的 VCS url
- python - ValueError: 数组的真值……不明确。将 tfa.metrics.F1Score 与 ModelCheckpoint 一起使用时使用 a.any() 或 a.all()
- python - 合并 Dataframe (pandas) 中的所有列 - python3
- vue.js - 如何在 Nuxt js 中使用命名路由?
- r - 错误:在 R 中找不到对象。标题未从 .csv 文件命名