Skip to content

Commit 2d22eae

Browse files
committed
[修改]1. 修改HTTP处理器的根地址处理
1 parent eb52699 commit 2d22eae

4 files changed

Lines changed: 7 additions & 217 deletions

File tree

GameFrameX.NetWork.HTTP/HttpHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static async Task HandleRequest(HttpContext context, Func<string, BaseHtt
3131
{
3232
var ip = context.Connection.RemoteIpAddress?.ToString();
3333
string url = context.Request.PathBase + context.Request.Path;
34-
var command = context.Request.Path.ToString().Substring(HttpServer.ApiRootPath.Length);
34+
var command = context.Request.Path.ToString().Substring(GlobalSettings.ApiRootPath.Length);
3535
var logHeader = $"[HTTPServer] TraceIdentifier:[{context.TraceIdentifier}], 来源[{ip}], url:[{url}]";
3636
LogHelper.Debug($"{logHeader},请求方式:[{context.Request.Method}]");
3737

GameFrameX.NetWork.HTTP/HttpServer.cs

Lines changed: 0 additions & 215 deletions
This file was deleted.

GameFrameX.StartUp/AppStartUpByServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private async Task StartServer<TMessageDecoderHandler, TMessageEncoderHandler>(L
315315
apiRootPath += "/";
316316
}
317317

318-
318+
GlobalSettings.ApiRootPath = apiRootPath;
319319
// 注册中间件
320320
app.UseEndpoints(configure =>
321321
{

GameFrameX.Utility/Setting/GlobalSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public static class GlobalSettings
4444
/// </summary>
4545
public static int ServerId { get; set; }
4646

47+
/// <summary>
48+
/// API根地址
49+
/// </summary>
50+
public static string ApiRootPath { get; set; }
51+
4752
/// <summary>
4853
/// 数据存储间隔 单位 毫秒,默认5分钟,最小1秒
4954
/// </summary>

0 commit comments

Comments
 (0)