From 6d74d659f6b580201bd37f09fc7834610679f0c5 Mon Sep 17 00:00:00 2001 From: GHXX Date: Sun, 14 Jan 2024 02:31:31 +0100 Subject: [PATCH] fix query args --- SimpleHttpServer/HttpServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimpleHttpServer/HttpServer.cs b/SimpleHttpServer/HttpServer.cs index e235541..1dde74e 100644 --- a/SimpleHttpServer/HttpServer.cs +++ b/SimpleHttpServer/HttpServer.cs @@ -111,7 +111,7 @@ public sealed class HttpServer { var par = methodParams[i]; var attr = par.GetCustomAttribute(false); qparams.Add((attr?.Name ?? par.Name ?? throw new ArgumentException($"C# variable name of parameter at index {i} of method {GetFancyMethodName()} is null!"), - (par.GetType(), attr?.IsOptional ?? false))); + (par.ParameterType, attr?.IsOptional ?? false))); if (!stringToTypeParameterConverters.ContainsKey(par.ParameterType)) { throw new MissingParameterConverterException($"Parameter converter for type {par.ParameterType} has not been registered (yet)!"); @@ -144,7 +144,7 @@ public sealed class HttpServer { var path = WebUtility.UrlDecode(splitted.First()); - if (simpleEndpointMethodInfos.TryGetValue((decUri, ctx.Request.HttpMethod.ToUpperInvariant()), out var endpointInvocationInfo)) { + if (simpleEndpointMethodInfos.TryGetValue((path, ctx.Request.HttpMethod.ToUpperInvariant()), out var endpointInvocationInfo)) { var mi = endpointInvocationInfo.methodInfo; var qparams = endpointInvocationInfo.queryParameters; var args = splitted.Length == 2 ? splitted[1] : null;