diff --git a/src/Readarr.Http/Extensions/RequestExtensions.cs b/src/Readarr.Http/Extensions/RequestExtensions.cs index 28ec573cf..21da78d99 100644 --- a/src/Readarr.Http/Extensions/RequestExtensions.cs +++ b/src/Readarr.Http/Extensions/RequestExtensions.cs @@ -54,5 +54,17 @@ namespace Readarr.Http.Extensions return request.Path.StartsWith("/MediaCover/", StringComparison.InvariantCultureIgnoreCase) || request.Path.StartsWith("/Content/Images/", StringComparison.InvariantCultureIgnoreCase); } + + public static int GetIntegerQueryParameter(this Request request, string parameter, int defaultValue = 0) + { + var parameterValue = request.Query[parameter]; + + if (parameterValue.HasValue) + { + return int.Parse(parameterValue.Value); + } + + return defaultValue; + } } }