This repository was archived by the owner on Dec 18, 2018. It is now read-only.
File tree 4 files changed +26
-7
lines changed
src/Microsoft.AspNet.Server.Kestrel/Http
test/Microsoft.AspNet.Server.KestrelTests 4 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ internal DateHeaderValueManager(
51
51
/// in accordance with http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18
52
52
/// </summary>
53
53
/// <returns>The value.</returns>
54
- public string GetDateHeaderValue ( )
54
+ public virtual string GetDateHeaderValue ( )
55
55
{
56
56
PumpTimer ( ) ;
57
57
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public class FrameResponseHeadersTests
14
14
[ Fact ]
15
15
public void InitialDictionaryContainsServerAndDate ( )
16
16
{
17
- var frame = new Frame ( new ConnectionContext ( ) ) ;
17
+ var frame = new Frame ( new ConnectionContext { DateHeaderValueManager = new DateHeaderValueManager ( ) } ) ;
18
18
IDictionary < string , StringValues > headers = frame . ResponseHeaders ;
19
19
20
20
Assert . Equal ( 2 , headers . Count ) ;
@@ -37,13 +37,15 @@ public void InitialDictionaryContainsServerAndDate()
37
37
[ Fact ]
38
38
public void InitialEntriesCanBeCleared ( )
39
39
{
40
- IDictionary < string , StringValues > headers = new FrameResponseHeaders ( ) ;
40
+ var frame = new Frame ( new ConnectionContext { DateHeaderValueManager = new DateHeaderValueManager ( ) } ) ;
41
+
42
+ Assert . True ( frame . ResponseHeaders . Count > 0 ) ;
41
43
42
- headers . Clear ( ) ;
44
+ frame . ResponseHeaders . Clear ( ) ;
43
45
44
- Assert . Equal ( 0 , headers . Count ) ;
45
- Assert . False ( headers . ContainsKey ( "Server" ) ) ;
46
- Assert . False ( headers . ContainsKey ( "Date" ) ) ;
46
+ Assert . Equal ( 0 , frame . ResponseHeaders . Count ) ;
47
+ Assert . False ( frame . ResponseHeaders . ContainsKey ( "Server" ) ) ;
48
+ Assert . False ( frame . ResponseHeaders . ContainsKey ( "Date" ) ) ;
47
49
}
48
50
}
49
51
}
Original file line number Diff line number Diff line change
1
+ // Copyright (c) .NET Foundation. All rights reserved.
2
+ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
+
4
+ using System ;
5
+ using Microsoft . AspNet . Server . Kestrel . Http ;
6
+
7
+ namespace Microsoft . AspNet . Server . KestrelTests
8
+ {
9
+ public class TestDateHeaderValueManager : DateHeaderValueManager
10
+ {
11
+ public override string GetDateHeaderValue ( )
12
+ {
13
+ return DateTimeOffset . UtcNow . ToString ( "r" ) ;
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ public TestServiceContext()
8
8
{
9
9
AppShutdown = new ShutdownNotImplemented ( ) ;
10
10
Log = new TestKestrelTrace ( ) ;
11
+ DateHeaderValueManager = new TestDateHeaderValueManager ( ) ;
11
12
}
12
13
}
13
14
}
You can’t perform that action at this time.
0 commit comments