Reputation: 10704
As you can see, i did a request which was successful. The issue I have is the 3 lined i have printed out below.
var headerList = request.getAllResponseHeaders();
print("RunTime type of Header List: ${headerList.runtimeType}");
print("Header List Count: ${headerList.length}");
print("Header List is as follows: \n$headerList");
So it seems that request, a HttpRequest
is not returning enough information. I was hoping it woudl return either a complete string of all header infomration, a Map of k=>v pairs, or an array.
Seems like it only fetched the first 64 characters.
Why would it not get all of the files? Ideally, I am trying to get the "Content-Disposition" header, by way of request.getResponseHeader("Content-Disposition");
but as you can imagine, given this information, it actually will return null, since the request cant find that information.
Upvotes: 2
Views: 320
Reputation: 658087
I guess you need to add
Access-Control-Expose-Headers
Content-Disposition
on your server.
Access-Control-Expose-Headers
(optional) - The XMLHttpRequest 2 object has agetResponseHeader()
method that returns the value of a particular response header. During a CORS request, thegetResponseHeader()
method can only access simple response headers. Simple response headers are defined as follows:
- Cache-Control
- Content-Language
- Content-Type
- Expires
- Last-Modified
- Pragma
If you want clients to be able to access other headers, you have to use the
Access-Control-Expose-Headers
header. The value of this header is a comma-delimited list of response headers you want to expose to the client.
From http://www.html5rocks.com/en/tutorials/cors/
Upvotes: 1