mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
fix: correct response status description in LoginRequestHandler and improve error logging in ServeDebugAppRequestHandler
This commit is contained in:
parent
b1a575e4d2
commit
3b57860123
2 changed files with 10 additions and 10 deletions
|
|
@ -71,7 +71,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
{
|
{
|
||||||
context.Response.StatusCode = 401;
|
context.Response.StatusCode = 401;
|
||||||
context.Response.StatusDescription = "Bad Request";
|
context.Response.StatusDescription = "Bad Request";
|
||||||
context.Response.StatusDescription = "Unauthorized";
|
|
||||||
context.Response.ContentType = "application/json";
|
context.Response.ContentType = "application/json";
|
||||||
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
|
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||||
context.Response.Write(JsonConvert.SerializeObject(new { Error = "Unauthorized" }, Formatting.Indented), false);
|
context.Response.Write(JsonConvert.SerializeObject(new { Error = "Unauthorized" }, Formatting.Indented), false);
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
if (TextExtensions.Contains(ext))
|
if (TextExtensions.Contains(ext))
|
||||||
{
|
{
|
||||||
string content;
|
string content;
|
||||||
using (var reader = new StreamReader(resolvedCandidate))
|
using (var reader = new StreamReader(resolvedCandidate, Encoding.UTF8))
|
||||||
content = reader.ReadToEnd();
|
content = reader.ReadToEnd();
|
||||||
|
|
||||||
context.Response.ContentEncoding = Encoding.UTF8;
|
context.Response.ContentEncoding = Encoding.UTF8;
|
||||||
|
|
@ -141,10 +141,11 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Error,
|
Debug.LogMessage(LogEventLevel.Error, ex,
|
||||||
"ServeDebugAppRequestHandler: Unhandled error serving '{rawUrl:l}': {ex}",
|
"ServeDebugAppRequestHandler: Unhandled error serving '{rawUrl:l}'",
|
||||||
context.Request.RawUrl, ex.Message);
|
context.Request.RawUrl);
|
||||||
try { SendResponse(context, 500, "Internal Server Error"); } catch { /* best-effort */ }
|
try { SendResponse(context, 500, "Internal Server Error"); }
|
||||||
|
catch { /* best-effort */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,8 +190,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Error,
|
Debug.LogMessage(LogEventLevel.Error, ex,
|
||||||
"ServeDebugAppRequestHandler: Error resolving HTML debug path: {ex}", ex.Message);
|
"ServeDebugAppRequestHandler: Error resolving HTML debug path");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue