cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5249
Views
0
Helpful
10
Replies

Unable to get content-disposition in headers when contacting cisco api

Hi, i have problem while getting content-disposition from headers using angular, while fetching a file from cisco api it was not allowing to fetch the content-disposition, so if anyone has idea on this situation please let me know how to resolve it(Java Script example is also fine).

Thank you

10 Replies 10

Janos Benyovszki
Cisco Employee
Cisco Employee

@Ananth Kakarlapudi what API are you exactly using? And how does your full request look like?

Hi @Janos Benyovszki i have shared you the error which i am getting and API which i am using, please let me know if you require any additional information thank you

Hi, 

When using this code i am getting CORS error as attachedMessageExport Cors error.PNG

let url = "https://webexapis.com/v1/contents/Y2lzY29zcGFyazovL3VzL0NPTlRFTlQvYWY3OTAwYjAtMDkwNi0xMWVkLTg3YmYtMmIxZjZlNWIxZjM5LzA"


this.http.get<any>(url, {
headers: new HttpHeaders({
'Content-Type': 'application/json',
Authorization: 'Bearer ' + data.access_token,
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods' : 'GET, POST, OPTIONS',
'Access-Control-Allow-Headers' : 'OX-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Content-Disposition, Authorization, authorization'
}),
responseType: 'blob' as 'json',
observe: 'response' as 'body'
} as any).subscribe((data1: HttpResponse<any>) => {
data1.headers.get('authorization');
const content = data1.headers.getAll('Content-Disposition');

What headers do you see if you log the header keys, something like this?

console.log(resp.headers.keys());

Hi @Jeff Marshall  i am getting cache-control, content-type when logging headers but not able to get content-disposition

 

We've opened a ticket with engineering to have them add the 'content-disposition' header to the allowed CORS headers so the browser will allow angular to see it. Not sure when that may be completed though.

Thanks @Jeff Marshall for the support

Based on what I'm finding it seems that angular has to be explicitly told what headers it's allowed to see by the server side using a Access-Control-Expose-Headers header.
Found several stackoverflow posts on it but this one is:
https://stackoverflow.com/questions/45480738/with-angulars-new-httpclient-how-can-i-get-all-headers-when-subscribing-to-the/45482346#45482346

In a quick test I did it seems angular can only see 'cache-control', 'content-type', and 'trackingid' headers from the /contents endpoint.

Can you send your details to devsupport@webex.com so a support ticket is generated and this can be investigated more thoroughly?

@Ananth Kakarlapudi, engineering has pushed out an update so now web apps, such as angular apps, should be able to see the content-disposition header.

Thank you @Jeff Marshall for the help yes its working now