From 43d1c5bffc2e32c2dcc9ed1f51ec4c213cdf686f Mon Sep 17 00:00:00 2001 From: lunat Date: Tue, 5 Jul 2016 14:42:43 +0200 Subject: [PATCH] CSharp client header problem CSharp client may cause an error adding an header because the header list is static. Added a check and a function tu set up the ApiKey --- .../main/resources/csharp/Configuration.mustache | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index 5ce03342baa..d2d7a9ad34b 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -158,9 +158,24 @@ namespace {{packageName}}.Client /// public void AddDefaultHeader(string key, string value) { + if (_defaultHeaderMap.ContainsKey(key)) + _defaultHeaderMap.Remove(key); _defaultHeaderMap.Add(key, value); } + /// + /// Add Api Key. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKeyPrefix(string key, string value) + { + if (ApiKeyPrefix.ContainsKey(key)) + ApiKeyPrefix.Remove(key); + ApiKeyPrefix.Add(key, value); + } + /// /// Gets or sets the HTTP user agent. ///