1
我必须从网页API返回文件的方法获取响应头获取的客户端
public static HttpResponseMessage FileAsFileAttachment(byte[] bytes, string filename)
{
var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(bytes) };
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = filename};
return result;
}
我怎样才能读取性反应的内容处理标头?
this.httpClient.fetch(`/company/get-asic-fee-autocomplete`).then(data=> { console.log(data.headers.get("Content-Disposition "))});
这个头总是空
如何获取文件名,并显示获取Aurelia大街,客户端的所有头???
(data.headers)
更多信息看起来像 https://gyazo.com/1d32a4e9226bac151102649d607716fa –
我看到有一个在你的代码'data.headers空间.get(“Content-Disposition”)。只要试试'data.headers.get(“content-disposition”)' –
不管。此值始终为空。也许aurelia fetch-client 不支持某些标题。 –