fix required GET args being present not triggering a 400 when no GET args were passed at all

This commit is contained in:
GHXX 2024-07-21 06:45:13 +02:00
parent d7a934e25c
commit 176c5e7197

View File

@ -255,6 +255,12 @@ public sealed class HttpServer {
}
}
}
} else {
var requiredParams = qparams.Where(x => !x.IsOptional).Select(x => $"'{x.Name}'").ToList();
if (requiredParams.Any()) {
await HandleDefaultErrorPageAsync(rc, HttpStatusCode.BadRequest, $"Missing required query parameter(s): {string.Join(",", requiredParams)}");
return;
}
}
convertedQParamValues[0] = rc;
rc.ParsedParameters = parsedQParams.AsReadOnly();