@@ -73,6 +73,24 @@ public void ConvertRequest_Creates_HttpRequestMessage_For_All_HttpMethods(HttpMe
73
73
Assert . Equal ( httpMethod , request . Method ) ;
74
74
}
75
75
76
+ [ Fact ]
77
+ public void ConvertRequest_DoesNotAddContentLength ( )
78
+ {
79
+ // Arrange
80
+ HttpContextBase contextBase = CreateStubContextBase ( "Get" , new MemoryStream ( ) ) ;
81
+
82
+ // Act
83
+ HttpRequestMessage request = HttpControllerHandler . ConvertRequest ( contextBase ) ;
84
+
85
+ // Assert
86
+ var headers = request . Content . Headers ;
87
+ Assert . NotNull ( headers ) ;
88
+ Assert . Null ( headers . ContentLength ) ;
89
+
90
+ IEnumerable < string > unused ;
91
+ Assert . False ( headers . TryGetValues ( "Content-Length" , out unused ) ) ;
92
+ }
93
+
76
94
[ Fact ]
77
95
public void ConvertRequest_Copies_Headers_And_Content_Headers ( )
78
96
{
@@ -130,8 +148,10 @@ public void ConvertRequest_AddsOwinEnvironment_WhenPresentInHttpContext()
130
148
{
131
149
HttpRequestBase stubRequest = CreateStubRequestBase ( "IgnoreMethod" , ignoreStream ) ;
132
150
IDictionary < string , object > expectedEnvironment = new Dictionary < string , object > ( ) ;
133
- IDictionary items = new Hashtable ( ) ;
134
- items . Add ( HttpControllerHandler . OwinEnvironmentHttpContextKey , expectedEnvironment ) ;
151
+ IDictionary items = new Hashtable
152
+ {
153
+ { HttpControllerHandler . OwinEnvironmentHttpContextKey , expectedEnvironment }
154
+ } ;
135
155
HttpContextBase context = CreateStubContextBase ( stubRequest , items ) ;
136
156
137
157
// Act
@@ -1946,13 +1966,6 @@ private static HttpResponseBase CreateStubResponseBase()
1946
1966
return new Mock < HttpResponseBase > ( ) . Object ;
1947
1967
}
1948
1968
1949
- private static HttpResponseBase CreateStubResponseBase ( CancellationToken clientDisconnectedToken )
1950
- {
1951
- Mock < HttpResponseBase > mock = new Mock < HttpResponseBase > ( ) ;
1952
- mock . Setup ( r => r . ClientDisconnectedToken ) . Returns ( clientDisconnectedToken ) ;
1953
- return mock . Object ;
1954
- }
1955
-
1956
1969
private static HttpResponseBase CreateStubResponseBase ( Stream outputStream )
1957
1970
{
1958
1971
Mock < HttpResponseBase > responseBaseMock = new Mock < HttpResponseBase > ( ) ;
0 commit comments