Skip to content

Commit

Permalink
Merge pull request #34 from catcherwong/depend-and-const
Browse files Browse the repository at this point in the history
upgrading dependencies and make some string to static readonly
  • Loading branch information
catcherwong authored Mar 1, 2022
2 parents 4317130 + 402c016 commit 86808ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Dtmcli/DtmClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class DtmClient : IDtmClient
{
private static readonly char Slash = '/';
private static readonly string QueryStringFormat = "dtm={0}&gid={1}&trans_type={2}&branch_id={3}&op={4}";
private static readonly string QuestionMark = "?";
private static readonly string And = "&";

private readonly IHttpClientFactory _httpClientFactory;
private readonly DtmOptions _dtmOptions;
Expand Down Expand Up @@ -82,8 +84,8 @@ public async Task<HttpResponseMessage> TransRequestBranch(TransBase tb, HttpMeth

var client = _httpClientFactory.CreateClient(Constant.BranchClientHttpName);

if (url.Contains("?")) url = string.Concat(url, "&" ,queryParams);
else url = string.Concat(url, "?", queryParams);
if (url.Contains(QuestionMark)) url = string.Concat(url, And, queryParams);
else url = string.Concat(url, QuestionMark, queryParams);

var httpRequestMsg = new HttpRequestMessage(method, url);
foreach (var item in tb.BranchHeaders ?? new Dictionary<string, string>())
Expand Down
2 changes: 1 addition & 1 deletion src/Dtmcli/Dtmcli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="DtmCommon" Version="0.5.0" />
<PackageReference Include="DtmCommon" Version="1.0.0" />
</ItemGroup>

</Project>

0 comments on commit 86808ba

Please sign in to comment.