Skip to content

Commit 979f610

Browse files
GetApplicationPath was wrong when used from REST services hosted at the root. (#988)
1 parent 75c9b5b commit 979f610

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

dotnet/src/dotnetcore/GxNetCoreStartup/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHos
465465

466466
app.UseWebSockets();
467467
string basePath = string.IsNullOrEmpty(VirtualPath) ? string.Empty : $"/{VirtualPath}";
468-
Config.ScriptPath = basePath;
468+
Config.ScriptPath = string.IsNullOrEmpty(basePath) ? "/" : basePath;
469469
app.MapWebSocketManager(basePath);
470470

471471
app.MapWhen(

dotnet/test/DotNetCoreWebUnitTest/Middleware/RestServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public async Task TestSimpleRestPost()
4949
response.EnsureSuccessStatusCode();
5050
Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode);
5151
string responseBody = await response.Content.ReadAsStringAsync();
52-
Assert.Equal("{}", responseBody);
52+
Assert.Equal("{\"ImagePath\":\"\\/imageName\"}", responseBody);
5353
}
5454

5555
[Fact(Skip = "Non deterministic")]

dotnet/test/DotNetCoreWebUnitTest/apps/saveimage.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
using GeneXus.Application;
22
using GeneXus.Data.NTier;
3-
3+
using GeneXus.Http.Server;
44
using GeneXus.Procedure;
5+
using Stubble.Core.Contexts;
56
namespace GeneXus.Programs.apps
67
{
78
public class saveimage : GXProcedure
@@ -19,9 +20,10 @@ public saveimage(IGxContext context)
1920
IsMain = false;
2021
}
2122

22-
public void execute(string aP0_ImageDescription, string aP1_Image)
23+
public void execute(string aP0_ImageDescription, string aP1_Image, out string aP2_ImagePath)
2324
{
2425
System.Console.WriteLine("SaveImage executed:" + aP0_ImageDescription);
26+
aP2_ImagePath= context.GetScriptPath() + aP1_Image;
2527
}
2628

2729
public override bool UploadEnabled()
@@ -32,8 +34,9 @@ public override bool UploadEnabled()
3234

3335
public override void initialize()
3436
{
35-
37+
httpResponse = new GxHttpResponse(context);
3638
}
39+
GxHttpResponse httpResponse;
3740
}
3841

3942
}

0 commit comments

Comments
 (0)