This repository was archived by the owner on Nov 20, 2018. It is now read-only.
File tree 2 files changed +18
-0
lines changed
src/Microsoft.AspNet.Http.Core
test/Microsoft.AspNet.Http.Core.Tests 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,18 @@ public override int GetHashCode()
227
227
return string . Concat ( left , right . ToString ( ) ) ;
228
228
}
229
229
230
+ /// <summary>
231
+ /// </summary>
232
+ /// <param name="left">The left parameter</param>
233
+ /// <param name="right">The right parameter</param>
234
+ /// <returns>The ToString combination of both values</returns>
235
+ public static string operator + ( PathString left , string right )
236
+ {
237
+ // This overload exists to prevent the implicit string<->PathString converter from
238
+ // trying to call the PathString+PathString operator for things that are not path strings.
239
+ return string . Concat ( left . ToString ( ) , right ) ;
240
+ }
241
+
230
242
/// <summary>
231
243
/// Operator call through to Add
232
244
/// </summary>
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ public void ImplicitStringConverters_WorksWithAdd()
63
63
64
64
var result = scheme + "://" + host + pathBase + path + query + fragment ;
65
65
Assert . Equal ( "http://localhost:80/base/path?query#frag" , result ) ;
66
+
67
+ result = pathBase + path + query + fragment ;
68
+ Assert . Equal ( "/base/path?query#frag" , result ) ;
69
+
70
+ result = path + "text" ;
71
+ Assert . Equal ( "/pathtext" , result ) ;
66
72
}
67
73
}
68
74
}
You can’t perform that action at this time.
0 commit comments