From 86e55596786f8d65854a75632512750b6e09faae Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 22 Sep 2017 01:57:18 -0400 Subject: switch mod update endpoint to GET with comma-delimited mod keys (#336) --- src/StardewModdingAPI.Web/Startup.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/StardewModdingAPI.Web/Startup.cs') diff --git a/src/StardewModdingAPI.Web/Startup.cs b/src/StardewModdingAPI.Web/Startup.cs index c7a5e8fe..c1f03b34 100644 --- a/src/StardewModdingAPI.Web/Startup.cs +++ b/src/StardewModdingAPI.Web/Startup.cs @@ -1,8 +1,11 @@ -using Microsoft.AspNetCore.Builder; +using System.Linq; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using StardewModdingAPI.Web.Framework; namespace StardewModdingAPI.Web { @@ -35,7 +38,13 @@ namespace StardewModdingAPI.Web /// The service injection container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc(); + services + .AddMvc(options => + { + // add support for comma-delimited parameters + ArrayModelBinderProvider arrayModelBinderProvider = options.ModelBinderProviders.OfType().First(); + options.ModelBinderProviders.Insert(options.ModelBinderProviders.IndexOf(arrayModelBinderProvider), new CommaDelimitedModelBinderProvider()); + }); } /// The method called by the runtime to configure the HTTP request pipeline. -- cgit