Skip to content

Commit 1e03588

Browse files
authored
Merge branch 'master' into Defect/61207-SSL
2 parents 6cb4c89 + 42a8a28 commit 1e03588

5 files changed

Lines changed: 38 additions & 13 deletions

File tree

Ginger/Ginger/Ginger.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@
749749
<PackageReference Include="LiteDB" Version="5.0.21" />
750750
<PackageReference Include="LiveCharts.Wpf.NetCore3" Version="0.9.8" />
751751
<PackageReference Include="log4net" Version="2.0.15" />
752-
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.11.1" />
752+
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.13.0" />
753753
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.3.0" />
754754
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.15.0" />
755755
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.15.0" />

Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222
using System;
2323
using System.Net.Http;
2424
using System.Text;
25+
using System.Text.Json;
2526
using System.Threading.Tasks;
2627

2728
namespace Amdocs.Ginger.CoreNET.External.WireMock
@@ -99,7 +100,8 @@ public async Task<string> StartRecordingAsync(string targetUrl)
99100

100101
using (HttpClient client = new HttpClient())
101102
{
102-
var content = new StringContent($"{{\"targetBaseUrl\": \"{targetUrl}\"}}", Encoding.UTF8, "application/json");
103+
string json = JsonSerializer.Serialize(new { targetBaseUrl = targetUrl });
104+
var content = new StringContent(json, Encoding.UTF8, "application/json");
103105
HttpResponseMessage response = await client.PostAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{StartRecordingEndpoint}", content);
104106
response.EnsureSuccessStatusCode();
105107
return await response.Content.ReadAsStringAsync();
@@ -153,7 +155,19 @@ public async Task<string> CreateStubAsync(string stubMapping, string contentType
153155
{
154156
contentType = "application/json";
155157
}
156-
var content = new StringContent(stubMapping, Encoding.UTF8, contentType);
158+
159+
string body;
160+
if (string.IsNullOrEmpty(stubMapping))
161+
{
162+
body = stubMapping;
163+
}
164+
else
165+
{
166+
using JsonDocument doc = JsonDocument.Parse(stubMapping);
167+
body = doc.RootElement.GetRawText();
168+
}
169+
170+
var content = new StringContent(body, Encoding.UTF8, contentType);
157171
HttpResponseMessage response = await client.PostAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{MappingEndpoint}", content);
158172
response.EnsureSuccessStatusCode();
159173
return await response.Content.ReadAsStringAsync();
@@ -204,7 +218,18 @@ public async Task<string> UpdateStubAsync(string stubId, string stubMapping)
204218

205219
using (HttpClient client = new HttpClient())
206220
{
207-
var content = new StringContent(stubMapping, Encoding.UTF8, "application/json");
221+
string body;
222+
if (string.IsNullOrEmpty(stubMapping))
223+
{
224+
body = stubMapping;
225+
}
226+
else
227+
{
228+
using JsonDocument doc = JsonDocument.Parse(stubMapping);
229+
body = doc.RootElement.GetRawText();
230+
}
231+
232+
var content = new StringContent(body, Encoding.UTF8, "application/json");
208233
HttpResponseMessage response = await client.PutAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{MappingEndpoint}/{stubId}", content);
209234
response.EnsureSuccessStatusCode();
210235
return await response.Content.ReadAsStringAsync();

Ginger/GingerCoreNET/GenAIServices/GenAIServiceHelper.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222
using System;
2323
using System.Collections.Generic;
2424
using System.IdentityModel.Tokens.Jwt;
25+
using System.Net;
2526
using System.Net.Http;
2627
using System.Threading.Tasks;
2728

@@ -104,8 +105,7 @@ private async Task<bool> GetToken()
104105
catch (Exception ex)
105106
{
106107
var error = "Failed to get access token";
107-
Reporter.ToLog(eLogLevel.ERROR, $"{error}, Error :{ex.Message}");
108-
Reporter.ToLog(eLogLevel.ERROR, $"{error}, Error :{ex.Message}, InnerException:{ex.InnerException},StackTrace:{ex.StackTrace}");
108+
Reporter.ToLog(eLogLevel.ERROR, error, ex);
109109
return false;
110110
}
111111
}
@@ -245,11 +245,11 @@ private MultipartFormDataContent PrepareRequestDetailsForChat(string Question)
245245
var content = new MultipartFormDataContent
246246
{
247247
{ new StringContent(Question), "question" },
248-
{ new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account)), "account" },
249-
{ new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType)), "domainType" },
250-
{ new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel)), "temperatureVal" },
251-
{ new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue)), "maxTokensVal" },
252-
{ new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath)), "dataPath" }
248+
{ new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account) ?? string.Empty)), "account" },
249+
{ new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType) ?? string.Empty)), "domainType" },
250+
{ new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel) ?? string.Empty)), "temperatureVal" },
251+
{ new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue) ?? string.Empty)), "maxTokensVal" },
252+
{ new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath) ?? string.Empty)), "dataPath" }
253253
};
254254
return content;
255255
}

Ginger/GingerCoreNET/GingerCoreNET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293

294294
<PackageReference Include="log4net" Version="2.0.15" />
295295

296-
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.11.1" />
296+
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.13.0" />
297297

298298
<PackageReference Include="MailKit" Version="4.14.1" />
299299

Ginger/GingerTest/GingerTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PackageReference Include="Ginger.ExecuterService.Contracts" Version="2026.3.0" />
2222
<PackageReference Include="GingerTestHelper" Version="2.0.2" />
2323
<PackageReference Include="log4net" Version="2.0.15" />
24-
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.11.1" />
24+
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.13.0" />
2525
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.15.0" />
2626
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.15.0" />
2727
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />

0 commit comments

Comments
 (0)