From 37c167aa74e3e20bf6d8c405685de9ba15afd0da Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 17 Dec 2015 15:32:51 -0800 Subject: [PATCH] Adding UrlEncoder to the ServiceCollection --- .../MapRouteRouteBuilderExtensions.cs | 4 ++-- src/Microsoft.AspNet.Routing/ServiceCollectionExtensions.cs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Routing/MapRouteRouteBuilderExtensions.cs b/src/Microsoft.AspNet.Routing/MapRouteRouteBuilderExtensions.cs index 21f2c26e70..04e6723f16 100644 --- a/src/Microsoft.AspNet.Routing/MapRouteRouteBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Routing/MapRouteRouteBuilderExtensions.cs @@ -108,8 +108,8 @@ namespace Microsoft.AspNet.Builder } var inlineConstraintResolver = routeBuilder - .ServiceProvider - .GetRequiredService(); + .ServiceProvider + .GetRequiredService(); routeBuilder.Routes.Add(new Route( routeBuilder.DefaultHandler, diff --git a/src/Microsoft.AspNet.Routing/ServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Routing/ServiceCollectionExtensions.cs index 0b9420e428..aba0ecd87b 100644 --- a/src/Microsoft.AspNet.Routing/ServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Routing/ServiceCollectionExtensions.cs @@ -2,7 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Text.Encodings.Web; using Microsoft.AspNet.Routing; +using Microsoft.Extensions.DependencyInjection.Extensions; namespace Microsoft.Extensions.DependencyInjection { @@ -25,6 +27,7 @@ namespace Microsoft.Extensions.DependencyInjection throw new ArgumentNullException(nameof(setupAction)); } + services.TryAddSingleton(UrlEncoder.Default); services.Configure(setupAction); } }