cancel
Showing results for 
Search instead for 
Did you mean: 

Error on Report Download API

 

Hi,

I found error on CyberSource.Api.ReportDownloadAPI- DownloadReportAsyncWithHttpInfo. I'm using package CyberSource.Rest.Client.NetStandard. Whenever I call that method with all required and valid configurations, i got error "An item with the same key has already been added. Key: Vary''. After debugging sometime i came to know that error is on this line=
  return new ApiResponse<object>(statusCode, restResponse.Headers.ToDictionary((HeaderParameter x) => x.Name, (HeaderParameter x) => x.Value.ToString()), restResponse.Content);. 

On this restResponse.Headers there're 2 vary key which is causing error.

Thank you.

Pramesh KC

pkc
Member
1 REPLY 1

The error arises because rest Response. Headers contains duplicate  Vary keys. You can handle this by modifying the code to handle duplicate keys, or by filtering the headers to ensure each key is unique before creating the ApiResponse  object.