diff --git a/backend/FwHeadless/Services/HttpHelpers.cs b/backend/FwHeadless/Services/HttpHelpers.cs new file mode 100644 index 000000000..663b8fc40 --- /dev/null +++ b/backend/FwHeadless/Services/HttpHelpers.cs @@ -0,0 +1,14 @@ +namespace FwHeadless.Services; + +public static class HttpHelpers +{ + public static Guid? GetProjectId(this HttpContext? context) + { + if (context is null) return null; + if (context.Request.Query.TryGetValue("projectId", out var projectIds) && projectIds.FirstOrDefault() is string idStr) + { + if (Guid.TryParse(idStr, out var projectId)) return projectId; + } + return null; + } +}