Skip to content

Commit 43d1c5b

Browse files
committed
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
1 parent 907361c commit 43d1c5b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,24 @@ namespace {{packageName}}.Client
158158
/// <returns></returns>
159159
public void AddDefaultHeader(string key, string value)
160160
{
161+
if (_defaultHeaderMap.ContainsKey(key))
162+
_defaultHeaderMap.Remove(key);
161163
_defaultHeaderMap.Add(key, value);
162164
}
163165

166+
/// <summary>
167+
/// Add Api Key.
168+
/// </summary>
169+
/// <param name="key">Api Key name.</param>
170+
/// <param name="value">Api Key value.</param>
171+
/// <returns></returns>
172+
public void AddApiKeyPrefix(string key, string value)
173+
{
174+
if (ApiKeyPrefix.ContainsKey(key))
175+
ApiKeyPrefix.Remove(key);
176+
ApiKeyPrefix.Add(key, value);
177+
}
178+
164179
/// <summary>
165180
/// Gets or sets the HTTP user agent.
166181
/// </summary>

0 commit comments

Comments
 (0)