Make RestType handling case-insensitive in switch

Convert RestType to uppercase in the switch statement to
ensure case-insensitive matching of REST types. This change
handles variations like "get", "Get", and "GET" consistently.
Additionally, use the null-conditional operator to prevent
NullReferenceException when RestType is null.
This commit is contained in:
Developer 02 2025-11-26 17:23:51 +01:00
parent 9a0a37471e
commit 5b7fce8fd6

View File

@ -26,7 +26,7 @@ public class InvokeRecActionCommandHandler(ISender sender) : IRequestHandler<Inv
using var http = new HttpClient();
using var response = await http.GetAsync("https://example.com", cancel);
switch (action.RestType)
switch (action.RestType?.ToUpper().Trim())
{
case "GET":
// Handle GET