mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-29 12:10:54 +00:00
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
This commit is contained in:
parent
907361cded
commit
43d1c5bffc
@ -158,9 +158,24 @@ namespace {{packageName}}.Client
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public void AddDefaultHeader(string key, string value)
|
public void AddDefaultHeader(string key, string value)
|
||||||
{
|
{
|
||||||
|
if (_defaultHeaderMap.ContainsKey(key))
|
||||||
|
_defaultHeaderMap.Remove(key);
|
||||||
_defaultHeaderMap.Add(key, value);
|
_defaultHeaderMap.Add(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Api Key.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Api Key name.</param>
|
||||||
|
/// <param name="value">Api Key value.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void AddApiKeyPrefix(string key, string value)
|
||||||
|
{
|
||||||
|
if (ApiKeyPrefix.ContainsKey(key))
|
||||||
|
ApiKeyPrefix.Remove(key);
|
||||||
|
ApiKeyPrefix.Add(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HTTP user agent.
|
/// Gets or sets the HTTP user agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user