File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Mvc.Core/src/Infrastructure
WebSites/BasicWebSite/Controllers Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -546,7 +546,7 @@ private Task BindArgumentsAsync()
546
546
{
547
547
var parameterInfo = declaredParameterInfos [ index ] ;
548
548
549
- if ( ! actionParameters . TryGetValue ( parameterInfo . Name ! , out var value ) )
549
+ if ( ! actionParameters . TryGetValue ( parameterInfo . Name ! , out var value ) || value is null )
550
550
{
551
551
value = actionMethodExecutor . GetDefaultValueForParameter ( index ) ;
552
552
}
Original file line number Diff line number Diff line change @@ -99,4 +99,18 @@ public async Task Controller_WithDefaultParameterValues_ForStructs_ReturnsBoundV
99
99
// Assert
100
100
Assert . Equal ( expected , response ) ;
101
101
}
102
+
103
+ [ Fact ]
104
+ public async Task EchoValue_DefaultParameterValue_ForGlobbedPath ( )
105
+ {
106
+ // Arrange
107
+ var expected = $ "index.html";
108
+ var url = "http://localhost/DefaultValues/EchoValue_DefaultParameterValue_ForGlobbedPath" ;
109
+
110
+ // Act
111
+ var response = await Client . GetStringAsync ( url ) ;
112
+
113
+ // Assert
114
+ Assert . Equal ( expected , response ) ;
115
+ }
102
116
}
Original file line number Diff line number Diff line change @@ -27,4 +27,11 @@ public string EchoValue_DefaultParameterValue_ForStructs(
27
27
{
28
28
return $ "{ guid } , { timeSpan } ";
29
29
}
30
+
31
+ [ HttpGet ]
32
+ [ Route ( "/[controller]/EchoValue_DefaultParameterValue_ForGlobbedPath/{**path}" ) ]
33
+ public string EchoValue_DefaultParameterValue_ForGlobbedPath ( string path = "index.html" )
34
+ {
35
+ return path ;
36
+ }
30
37
}
You can’t perform that action at this time.
0 commit comments