refactored responses

This commit is contained in:
2025-04-06 15:37:32 +05:00
parent 3c1d195849
commit d70b605127
17 changed files with 415 additions and 263 deletions
@@ -0,0 +1,17 @@
using System.Linq;
using System.Net;
namespace ParadoxSaveParser.WebAPI.HttpHelpers;
public class RequestHelper
{
internal static ValueOrError<string> GetQueryValue(HttpListenerContext ctx, string paramName)
{
string[]? values = ctx.Request.QueryString.GetValues(paramName);
string? value = values?.FirstOrDefault();
if (string.IsNullOrEmpty(value))
return new ErrorMessage(HttpStatusCode.BadRequest,
$"No request parameter '{paramName}' provided");
return value;
}
}