Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用键存在检测替换使用异常捕获模式操作字典 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 23 additions & 33 deletions QCloudCSharpSDK/COSXML/Model/CosRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public bool? IsHttps
{
return isHttps;
}

set { isHttps = value; }
}

Expand All @@ -97,7 +97,7 @@ public string RequestPath
{
return path;
}

private set { }
}

Expand Down Expand Up @@ -139,26 +139,21 @@ public void SetQueryParameter(string key, string value)
/// <param name="isNeedUrlEncode"></param>
public void SetQueryParameter(string key, string value, bool isNeedUrlEncode)
{

try
if (value == null)
{
value = "";
}

if (value == null)
{
value = "";
}

if (isNeedUrlEncode)
{
value = URLEncodeUtils.Encode(value);
}

if (isNeedUrlEncode)
{
value = URLEncodeUtils.Encode(value);
}
if (!queryParameters.ContainsKey(key))
{
queryParameters.Add(key, value);
}
catch (ArgumentException)
else
{
// cover the current value
// cover the current value
queryParameters[key] = value;
}
}
Expand Down Expand Up @@ -194,26 +189,21 @@ public void SetRequestHeaders(Dictionary<string, string> headers)
/// <param name="isNeedUrlEncode"></param>
public void SetRequestHeader(string key, string value, bool isNeedUrlEncode)
{

try
if (value == null)
{
value = "";
}

if (value == null)
{
value = "";
}

if (isNeedUrlEncode)
{
value = URLEncodeUtils.Encode(value);
}

if (isNeedUrlEncode)
{
value = URLEncodeUtils.Encode(value);
}
if (!headers.ContainsKey(key))
{
headers.Add(key, value);
}
catch (ArgumentException)
else
{
// cover the current value
// cover the current value
headers[key] = value;
}
}
Expand Down Expand Up @@ -315,7 +305,7 @@ public virtual void SetSign(string sign)
public virtual CosXmlSignSourceProvider GetSignSourceProvider()
{
// 默认签署的头部跟参数
cosXmlSignSourceProvider.AddHeaderKeys(new List<string>()
cosXmlSignSourceProvider.AddHeaderKeys(new List<string>()
{
"cache-control",
"content-disposition",
Expand Down