diff --git a/src/Microsoft.AspNet.Http.Core/PathString.cs b/src/Microsoft.AspNet.Http.Core/PathString.cs
index 11249afb91..fe33adc2ba 100644
--- a/src/Microsoft.AspNet.Http.Core/PathString.cs
+++ b/src/Microsoft.AspNet.Http.Core/PathString.cs
@@ -215,6 +215,18 @@ namespace Microsoft.AspNet.Http
return !left.Equals(right, StringComparison.OrdinalIgnoreCase);
}
+ ///
+ ///
+ /// The left parameter
+ /// The right parameter
+ /// The ToString combination of both values
+ public static string operator +(string left, PathString right)
+ {
+ // This overload exists to prevent the implicit string<->PathString converter from
+ // trying to call the PathString+PathString operator for things that are not path strings.
+ return string.Concat(left, right.ToString());
+ }
+
///
/// Operator call through to Add
///
diff --git a/test/Microsoft.AspNet.Http.Core.Tests/PathStringTests.cs b/test/Microsoft.AspNet.Http.Core.Tests/PathStringTests.cs
index d547c0a4ac..d4a5502cbb 100644
--- a/test/Microsoft.AspNet.Http.Core.Tests/PathStringTests.cs
+++ b/test/Microsoft.AspNet.Http.Core.Tests/PathStringTests.cs
@@ -50,5 +50,19 @@ namespace Microsoft.AspNet.Http
// Assert
Assert.Equal(expected, result.Value);
}
+
+ [Fact]
+ public void ImplicitStringConverters_WorksWithAdd()
+ {
+ var scheme = "http";
+ var host = new HostString("localhost:80");
+ var pathBase = new PathString("/base");
+ var path = new PathString("/path");
+ var query = new QueryString("?query");
+ var fragment = new FragmentString("#frag");
+
+ var result = scheme + "://" + host + pathBase + path + query + fragment;
+ Assert.Equal("http://localhost:80/base/path?query#frag", result);
+ }
}
}