I have following code in my C# web api
HttpResponseMessage result = null;
var stream = new MemoryStream(File.ReadAllBytes(tempFileName));
result = Request.CreateResponse(HttpStatusCode.OK);
result.Content = new StreamContent(stream);
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
result.Content.Headers.add("fileName", Path.GetFileName(tempFileName ));
File.Delete(tempFileName);
return result;
and following on client side
var deferred = this.$q.defer();
this.$http({
method: 'GET',
url: someURL,
responseType: 'arraybuffer'
}).then(function (response: any) {
var blob = new Blob([response.data], { type: "application/octet-stream" });
var link = document.createElement('a');
var url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute("download", "demo.doc");
link.click();
deferred.resolve();
});
return deferred.promise;
But when I add watch for response.headers() on client side javascript it only shows me following
{content-type: "application/octet-stream", cache-control: "private"}
Can some one help me find where the fileName header is?