diff --git a/Controllers/SimApiBaseController.cs b/Controllers/SimApiBaseController.cs
index 046aae4..8c25af1 100644
--- a/Controllers/SimApiBaseController.cs
+++ b/Controllers/SimApiBaseController.cs
@@ -47,7 +47,7 @@ namespace SimApi.Controllers
/// 错误代码
/// 错误描述(若是常规错误,代码可自动带取描述)
///
- protected static void Error(int code = 500, string message = "")
+ protected static void Error(int code = 500, string message = "服务器错误")
{
throw new SimApiException(code, message);
}
@@ -58,7 +58,7 @@ namespace SimApi.Controllers
/// 检测条件
/// 错误代码
/// 错误描述
- protected static void ErrorWhen(bool condition, int code = 500, string message = "")
+ protected static void ErrorWhen(bool condition, int code = 500, string message = "服务器错误")
{
if (condition)
{
@@ -72,7 +72,7 @@ namespace SimApi.Controllers
/// 检测条件
/// 错误代码
/// 错误描述
- protected static void ErrorWhenNull(object condition, int code = 404, string message = "")
+ protected static void ErrorWhenNull(object condition, int code = 404, string message = "资源不存在")
{
ErrorWhen(condition == null, code, message);
}
diff --git a/Middlewares/SimApiAuthMiddleware.cs b/Middlewares/SimApiAuthMiddleware.cs
index a02b65a..409db51 100644
--- a/Middlewares/SimApiAuthMiddleware.cs
+++ b/Middlewares/SimApiAuthMiddleware.cs
@@ -34,7 +34,7 @@ namespace SimApi.Middlewares
httpContext.Items.Add("LoginInfo", JsonSerializer.Deserialize(login));
}
}
-
+
return Next(httpContext);
}
}
diff --git a/Middlewares/SimApiExceptionMiddleware.cs b/Middlewares/SimApiExceptionMiddleware.cs
index 566bce6..5936577 100644
--- a/Middlewares/SimApiExceptionMiddleware.cs
+++ b/Middlewares/SimApiExceptionMiddleware.cs
@@ -23,6 +23,11 @@ namespace SimApi.Middlewares
public async Task InvokeAsync(HttpContext context)
{
+ if (context.Request.Headers.ContainsKey("Query-Id"))
+ {
+ context.Response.Headers["Query-Id"] = context.Request.Headers["Query-Id"];
+ }
+
var response = new SimApiBaseResponse();
try
{