api接口加上默认域名

This commit is contained in:
2024-07-10 13:53:24 +08:00
parent 7a50a74c70
commit 3de4f9b520

View File

@@ -1099,13 +1099,18 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
try
{
string tempPath = entity.Path;
if (!string.IsNullOrEmpty(tempPath) && !tempPath.StartsWith("http"))
{
tempPath = $"{App.HttpContext.Request.Scheme}://{App.HttpContext.Request.Host}{tempPath}";
}
switch (entity.RequestMethod)
{
case "6":
result = (await entity.Path.SetHeaders(dicHerader).SetQueries(dic).GetAsStringAsync()).ToObject<JObject>();
result = (await tempPath.SetHeaders(dicHerader).SetQueries(dic).GetAsStringAsync()).ToObject<JObject>();
break;
case "7":
result = (await entity.Path.SetHeaders(dicHerader).SetBody(dic).PostAsStringAsync()).ToObject<JObject>();
result = (await tempPath.SetHeaders(dicHerader).SetBody(dic).PostAsStringAsync()).ToObject<JObject>();
break;
}
}