This repository was archived by the owner on Nov 20, 2018. It is now read-only.
File tree 2 files changed +12
-4
lines changed
src/Microsoft.AspNetCore.Http.Abstractions
test/Microsoft.AspNetCore.Http.Abstractions.Tests
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -450,9 +450,7 @@ public static implicit operator PathString(string s)
450
450
/// </summary>
451
451
/// <param name="path"></param>
452
452
public static implicit operator string ( PathString path )
453
- {
454
- return path . ToString ( ) ;
455
- }
453
+ => path . ToString ( ) ;
456
454
457
455
internal static PathString ConvertFromString ( string s )
458
456
=> string . IsNullOrEmpty ( s ) ? new PathString ( s ) : FromUriComponent ( s ) ;
Original file line number Diff line number Diff line change 1
- // Copyright (c) .NET Foundation. All rights reserved.
1
+ // Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
4
using System ;
@@ -221,5 +221,15 @@ public void PathStringConvertsOnlyToAndFromString()
221
221
Assert . False ( converter . CanConvertTo ( typeof ( int ) ) ) ;
222
222
Assert . False ( converter . CanConvertTo ( typeof ( bool ) ) ) ;
223
223
}
224
+
225
+ [ Fact ]
226
+ public void PathStringStaysEqualAfterAssignments ( )
227
+ {
228
+ PathString p1 = "/?" ;
229
+ string s1 = p1 ; // Becomes "/%3F"
230
+ PathString p2 = s1 ; // Stays "/%3F"
231
+ Assert . Equal ( p1 , p2 ) ;
232
+ }
233
+
224
234
}
225
235
}
You can’t perform that action at this time.
0 commit comments