From d51647a4b51292fce6656345a39e37e32a570c19 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Fri, 8 Aug 2025 09:11:05 +0200 Subject: [PATCH] use default value of parameter if available --- Pilz.Net/Api/ApiServer.cs | 2 ++ Pilz.Net/Pilz.Net.csproj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index ef9e358..62887ea 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -551,6 +551,8 @@ public class ApiServer : IApiServer objs.Add(Convert.ChangeType(HttpUtility.UrlDecode(parameterValue), info.ParameterType)); // or Uri.UnescapeDataString(); maybe run this line twice? else if (queryparams.AllKeys.FirstOrDefault(n => n != null && n.Equals(info.Name, StringComparison.InvariantCultureIgnoreCase)) is string querykey) objs.Add(Convert.ChangeType(HttpUtility.UrlDecode(queryparams.Get(querykey)), info.ParameterType)); + else if (info.HasDefaultValue) + objs.Add(info.DefaultValue); else objs.Add(null); } diff --git a/Pilz.Net/Pilz.Net.csproj b/Pilz.Net/Pilz.Net.csproj index bd586fb..ab951d6 100644 --- a/Pilz.Net/Pilz.Net.csproj +++ b/Pilz.Net/Pilz.Net.csproj @@ -8,7 +8,7 @@ - 2.6.8 + 2.6.9