Base:
property
Request
Microsoft.AspNetCore.Http.HttpContext.Request
34 writes to Request
Microsoft.AspNetCore.Http.Extensions.Tests (2)
ParameterBindingMethodCacheTests.cs (2)
237
Request
=
268
Request
=
Microsoft.AspNetCore.Mvc.Core.Test (6)
Routing\UrlHelperExtensionsTest.cs (6)
611
Request
=
646
Request
=
681
Request
=
719
Request
=
767
Request
=
815
Request
=
Microsoft.AspNetCore.Mvc.RazorPages.Test (16)
ApplicationModels\DefaultPageApplicationModelProviderTest.cs (1)
992
Request
=
Infrastructure\DefaultPageHandlerMethodSelectorTest.cs (15)
39
Request
=
87
Request
=
138
Request
=
182
Request
=
218
Request
=
261
Request
=
311
Request
=
361
Request
=
412
Request
=
456
Request
=
507
Request
=
552
Request
=
602
Request
=
652
Request
=
712
Request
=
Microsoft.AspNetCore.Routing.Tests (10)
Builder\EndpointRoutingApplicationBuilderExtensionsTest.cs (1)
273
requestDelegate(new DefaultHttpContext() {
Request
= { Path = "/Foo", }, });
EndpointRoutingMiddlewareFormOptionsTest.cs (1)
194
Request
=
Matching\AcceptsMatcherPolicyTest.cs (8)
388
Request
=
415
Request
=
442
Request
=
469
Request
=
496
Request
=
523
Request
=
552
Request
=
581
Request
=
955 references to Request
Aspire.Dashboard.Tests (2)
BrowserSecurityHeadersMiddlewareTests.cs (1)
55
httpContext.
Request
.Scheme = scheme;
OtlpApiKeyAuthenticationHandlerTests.cs (1)
98
httpContext.
Request
.Headers[OtlpApiKeyAuthenticationHandler.ApiKeyHeaderName] = otlpApiKeyHeader;
HttpAbstractions.SampleApp (1)
Program.cs (1)
14
var request = context.
Request
;
Microsoft.AspNetCore.Antiforgery.Test (2)
AntiforgeryMiddlewareTest.cs (2)
22
httpContext.
Request
.Method = method;
54
httpContext.
Request
.Method = method;
Microsoft.AspNetCore.Components.Endpoints.Tests (14)
EndpointHtmlRendererTest.cs (10)
758
ctx.
Request
.Scheme = "http";
759
ctx.
Request
.Host = new HostString("localhost");
760
ctx.
Request
.PathBase = "/base";
761
ctx.
Request
.Path = "/path";
762
ctx.
Request
.QueryString = new QueryString("?query=value");
789
ctx.
Request
.Scheme = "http";
790
ctx.
Request
.Host = new HostString("localhost");
791
ctx.
Request
.PathBase = "/base";
792
ctx.
Request
.Path = "/path";
793
ctx.
Request
.QueryString = new QueryString("?query=value");
RazorComponentEndpointInvokerTest.cs (2)
43
context.
Request
.Method = "POST";
44
context.
Request
.ContentType = "application/json";
RazorComponentResultTest.cs (2)
472
result.
Request
.Scheme = "https";
473
result.
Request
.Host = new HostString("test");
Microsoft.AspNetCore.Components.Server.Tests (17)
CircuitDisconnectMiddlewareTest.cs (17)
35
context.
Request
.Method = httpMethod;
63
context.
Request
.Method = HttpMethods.Post;
64
context.
Request
.ContentType = contentType;
90
context.
Request
.Method = HttpMethods.Post;
91
context.
Request
.ContentType = "application/x-www-form-urlencoded";
121
context.
Request
.Method = HttpMethods.Post;
122
context.
Request
.ContentType = "application/x-www-form-urlencoded";
123
context.
Request
.Body = memory;
154
context.
Request
.Method = HttpMethods.Post;
155
context.
Request
.ContentType = "application/x-www-form-urlencoded";
156
context.
Request
.Body = memory;
191
context.
Request
.Method = HttpMethods.Post;
192
context.
Request
.ContentType = "application/x-www-form-urlencoded";
193
context.
Request
.Body = memory;
229
context.
Request
.Method = HttpMethods.Post;
230
context.
Request
.ContentType = "application/x-www-form-urlencoded";
231
context.
Request
.Body = memory;
Microsoft.AspNetCore.Components.WebAssembly.Server.Tests (27)
ContentEncodingNegotiatorTests.cs (27)
23
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
24
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
28
Assert.Equal(expectedPath, httpContext.
Request
.Path);
45
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
46
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
50
Assert.Equal(expectedPath, httpContext.
Request
.Path);
66
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
67
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
71
Assert.Equal(expectedPath, httpContext.
Request
.Path);
89
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
90
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
94
Assert.Equal(expectedPath, httpContext.
Request
.Path);
112
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
113
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
117
Assert.Equal(expectedPath, httpContext.
Request
.Path);
135
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
136
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
140
Assert.Equal(expectedPath, httpContext.
Request
.Path);
158
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
159
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
163
Assert.Equal(expectedPath, httpContext.
Request
.Path);
180
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
181
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
185
Assert.Equal(expectedPath, httpContext.
Request
.Path);
201
httpContext.
Request
.Path = "/_framework/blazor.boot.json";
202
httpContext.
Request
.Headers.Append(HeaderNames.AcceptEncoding, encoding);
206
Assert.Equal(expectedPath, httpContext.
Request
.Path);
Microsoft.AspNetCore.Cors.Test (24)
CorsMiddlewareTests.cs (20)
392
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
421
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
658
httpContext.
Request
.Method = "OPTIONS";
659
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { OriginUrl });
660
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, new[] { "PUT" });
700
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
730
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
757
httpContext.
Request
.Method = "OPTIONS";
758
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
759
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, new[] { "GET" });
789
httpContext.
Request
.Method = "GET";
790
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
791
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, new[] { "GET" });
822
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
857
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
894
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
927
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
957
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
984
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
1032
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { "http://example.com" });
CorsServiceTests.cs (4)
953
context.
Request
.Method = method;
958
context.
Request
.Headers.Add(CorsConstants.Origin, new[] { origin });
963
context.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, new[] { accessControlRequestMethod });
968
context.
Request
.Headers.Add(CorsConstants.AccessControlRequestHeaders, accessControlRequestHeaders);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (84)
Infrastructure\TestHelpers.cs (1)
27
httpContext.
Request
.Host = new HostString("localhost");
JsonTranscodingRouteAdapterTests.cs (16)
39
httpContext.
Request
.RouteValues = new RouteValueDictionary
47
Assert.Equal("shelves/first/books/second", httpContext.
Request
.RouteValues["book.name"]);
139
httpContext.
Request
.RouteValues = new RouteValueDictionary
146
Assert.Equal("a/my/value/b", httpContext.
Request
.RouteValues["x.y.z"]);
158
httpContext.
Request
.RouteValues = new RouteValueDictionary
165
Assert.Equal("a/my/value/b", httpContext.
Request
.RouteValues["x.y.z"]);
177
httpContext.
Request
.RouteValues = new RouteValueDictionary
184
Assert.Equal("c/value", httpContext.
Request
.RouteValues["b"]);
196
httpContext.
Request
.RouteValues = new RouteValueDictionary
203
Assert.Equal("c/value/d", httpContext.
Request
.RouteValues["b"]);
215
httpContext.
Request
.RouteValues = new RouteValueDictionary
222
Assert.Equal("c/value", httpContext.
Request
.RouteValues["b"]);
252
httpContext.
Request
.RouteValues = new RouteValueDictionary
259
Assert.Equal("test/name", httpContext.
Request
.RouteValues["name"]);
271
httpContext.
Request
.RouteValues = new RouteValueDictionary
278
Assert.Equal("test/name/", httpContext.
Request
.RouteValues["name"]);
JsonTranscodingServerCallContextTests.cs (6)
40
httpContext.
Request
.Headers.Append("TestName", "TestValue");
41
httpContext.
Request
.Headers.Append(":method", "GET");
42
httpContext.
Request
.Headers.Append("grpc-encoding", "identity");
43
httpContext.
Request
.Headers.Append("grpc-timeout", "1S");
44
httpContext.
Request
.Headers.Append("hello-bin", Convert.ToBase64String(new byte[] { 1, 2, 3 }));
64
httpContext.
Request
.Host = new HostString("localhost");
ServerStreamingServerCallHandlerTests.cs (5)
57
httpContext.
Request
.RouteValues["name"] = "TestName!";
104
httpContext.
Request
.RouteValues["name"] = "TestName!";
146
httpContext.
Request
.RouteValues["name"] = "TestName!";
187
httpContext.
Request
.RouteValues["name"] = "TestName!";
238
httpContext.
Request
.RouteValues["name"] = "TestName!";
UnaryServerCallHandlerTests.cs (56)
66
httpContext.
Request
.RouteValues["name"] = "TestName!";
67
httpContext.
Request
.RouteValues["sub.subfield"] = "Subfield!";
109
httpContext.
Request
.RouteValues["name"] = name;
143
httpContext.
Request
.RouteValues["name"] = "Doesn't matter";
201
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(JsonFormatter.Default.Format(new HelloRequest
205
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
210
httpContext.
Request
.ContentType = "application/json";
239
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(JsonFormatter.Default.Format(new HelloRequest.Types.SubMessage
243
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
249
httpContext.
Request
.ContentType = "application/json";
289
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(sw.ToString()));
290
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
296
httpContext.
Request
.ContentType = "application/json";
339
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(sw.ToString()));
340
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
346
httpContext.
Request
.ContentType = "application/json";
389
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(sw.ToString()));
390
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
396
httpContext.
Request
.ContentType = "application/json";
439
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(sw.ToString()));
440
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
446
httpContext.
Request
.ContentType = "application/json";
489
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(sw.ToString()));
490
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
496
httpContext.
Request
.ContentType = "application/json";
524
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
552
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
583
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
619
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
650
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
676
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
703
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
739
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(json));
740
httpContext.
Request
.ContentType = "application/json";
777
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(json));
778
httpContext.
Request
.ContentType = "application/json";
806
httpContext.
Request
.Body = new MemoryStream("{}"u8.ToArray());
807
httpContext.
Request
.ContentType = contentType;
1140
httpContext.
Request
.ContentType = "application/xml";
1141
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(requestContent));
1184
httpContext.
Request
.ContentType = "application/octet-stream";
1191
httpContext.
Request
.Body = new MemoryStream(requestContent);
1194
httpContext.
Request
.ContentLength = requestSize;
1227
httpContext.
Request
.ContentType = "application/json";
1228
httpContext.
Request
.Body = new MemoryStream("null"u8.ToArray());
1262
httpContext.
Request
.ContentType = "application/json";
1263
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(requestJson));
1324
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(requestContent));
1325
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1492
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1520
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1664
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1723
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(requestJson));
1724
httpContext.
Request
.ContentType = "application/json";
1759
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1793
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
Microsoft.AspNetCore.HeaderPropagation.Tests (8)
HeaderPropagationMiddlewareTest.cs (8)
40
Context.
Request
.Headers.Add("in", "test");
67
Context.
Request
.Headers.Add("in", "test");
82
Context.
Request
.Headers.Add("in", "test");
83
Context.
Request
.Headers.Add("another", "test2");
102
Context.
Request
.Headers.Add("in", headerValue);
128
Context.
Request
.Headers.Add("in", "value");
146
Context.
Request
.Headers.Add("in", "no");
161
Context.
Request
.Headers.Add("in", "no");
Microsoft.AspNetCore.Hosting.Tests (45)
HostingApplicationDiagnosticsTests.cs (35)
240
c.
Request
.Protocol = "1.1";
241
c.
Request
.Scheme = "http";
242
c.
Request
.Method = "POST";
243
c.
Request
.Host = new HostString("localhost");
244
c.
Request
.Path = "/hello";
245
c.
Request
.ContentType = "text/plain";
246
c.
Request
.ContentLength = 1024;
299
c.
Request
.Protocol = "1.1";
300
c.
Request
.Scheme = "http";
301
c.
Request
.Method = "POST";
302
c.
Request
.Host = new HostString("localhost");
303
c.
Request
.Path = "/hello";
304
c.
Request
.ContentType = "text/plain";
305
c.
Request
.ContentLength = 1024;
359
c.
Request
.Protocol = "1.1";
360
c.
Request
.Scheme = "http";
361
c.
Request
.Method = "POST";
362
c.
Request
.Host = new HostString("localhost");
363
c.
Request
.Path = "/hello";
364
c.
Request
.ContentType = "text/plain";
365
c.
Request
.ContentLength = 1024;
414
c.
Request
.Protocol = "1.1";
415
c.
Request
.Scheme = "http";
416
c.
Request
.Method = "POST";
417
c.
Request
.Host = new HostString("localhost");
418
c.
Request
.Path = "/hello";
419
c.
Request
.ContentType = "text/plain";
420
c.
Request
.ContentLength = 1024;
1049
c.
Request
.Protocol = "1.1";
1050
c.
Request
.Scheme = "http";
1051
c.
Request
.Method = "POST";
1052
c.
Request
.Host = new HostString("localhost");
1053
c.
Request
.Path = "/hello";
1054
c.
Request
.ContentType = "text/plain";
1055
c.
Request
.ContentLength = 1024;
HostingMetricsTests.cs (4)
36
httpContext.
Request
.Protocol = HttpProtocol.Http11;
48
httpContext.
Request
.Protocol = HttpProtocol.Http2;
63
httpContext.
Request
.Protocol = HttpProtocol.Http3;
134
httpContext.
Request
.Protocol = HttpProtocol.Http11;
Internal\HostingEventSourceTests.cs (6)
79
context.
Request
.Method = "GET";
80
context.
Request
.Path = "/Home/Index";
90
context.
Request
.Method = "POST";
91
context.
Request
.Path = "/";
115
hostingEventSource.RequestStart(httpContext.
Request
.Method, httpContext.
Request
.Path);
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
CookieBuilderTests.cs (1)
22
context.
Request
.IsHttps = requestIsHttps;
Microsoft.AspNetCore.Http.Connections.Tests (118)
HttpConnectionDispatcherTests.cs (117)
66
context.
Request
.Path = "/foo";
67
context.
Request
.Method = "POST";
90
context.
Request
.Path = "/foo";
91
context.
Request
.Method = "POST";
93
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
116
context.
Request
.Path = "/foo";
117
context.
Request
.Method = "POST";
119
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
124
context.
Request
.QueryString = context.
Request
.QueryString.Add("id", connectionToken);
153
context.
Request
.Path = "/foo";
154
context.
Request
.Method = "POST";
156
context.
Request
.QueryString = new QueryString("?negotiateVersion=Invalid");
181
context.
Request
.Path = "/foo";
182
context.
Request
.Method = "POST";
184
context.
Request
.QueryString = new QueryString("");
220
context.
Request
.Body = requestBody;
226
context.
Request
.Path = "/foo";
227
context.
Request
.Method = "POST";
232
context.
Request
.Query = qs;
268
context.
Request
.Path = "/foo";
269
context.
Request
.Method = "POST";
271
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
306
context.
Request
.Path = "/foo";
307
context.
Request
.Method = "GET";
312
context.
Request
.Query = qs;
348
context.
Request
.Path = "/foo";
349
context.
Request
.Method = "POST";
354
context.
Request
.Query = qs;
386
context.
Request
.Path = "/foo";
387
context.
Request
.Method = "POST";
392
context.
Request
.Query = qs;
425
context.
Request
.Path = "/foo";
426
context.
Request
.Method = "POST";
431
context.
Request
.Query = qs;
465
context.
Request
.Path = "/foo";
466
context.
Request
.Method = "GET";
471
context.
Request
.Query = qs;
528
context.
Request
.Path = "/foo";
529
context.
Request
.Method = "GET";
534
context.
Request
.Query = qs;
590
context.
Request
.Body = requestBody;
596
context.
Request
.Path = "/foo";
597
context.
Request
.Method = "POST";
602
context.
Request
.Query = qs;
654
context.
Request
.Body = requestBody;
659
context.
Request
.Path = "/foo";
660
context.
Request
.Method = "POST";
665
context.
Request
.Query = qs;
755
context.
Request
.Body = requestBody;
763
context.
Request
.Path = "/foo";
764
context.
Request
.Method = "GET";
770
context.
Request
.Query = qs;
771
context.
Request
.Headers["header1"] = "h1";
772
context.
Request
.Headers["header2"] = "h2";
773
context.
Request
.Headers["header3"] = "h3";
858
context.
Request
.Path = "/foo";
859
context.
Request
.Method = "GET";
860
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
899
context.
Request
.Body = mockStream.Object;
905
context.
Request
.Path = "/foo";
906
context.
Request
.Method = "POST";
911
context.
Request
.Query = qs;
934
context.
Request
.Path = "/foo";
935
context.
Request
.Method = "POST";
936
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
1839
context.
Request
.Path = "/foo";
1840
context.
Request
.Method = "GET";
1846
context.
Request
.Query = qs;
1891
context.
Request
.Path = "/foo";
1892
context.
Request
.Method = "GET";
1898
context.
Request
.Query = qs;
2034
deleteContext.
Request
.Path = "/foo";
2035
deleteContext.
Request
.QueryString = new QueryString($"?id={connection.ConnectionToken}");
2036
deleteContext.
Request
.Method = "DELETE";
2077
deleteContext.
Request
.Path = "/foo";
2078
deleteContext.
Request
.QueryString = new QueryString($"?id={connection.ConnectionToken}");
2079
deleteContext.
Request
.Method = "DELETE";
2127
deleteContext.
Request
.Path = "/foo";
2128
deleteContext.
Request
.QueryString = new QueryString($"?id={connection.ConnectionToken}");
2129
deleteContext.
Request
.Method = "DELETE";
2182
deleteContext.
Request
.Path = "/foo";
2183
deleteContext.
Request
.QueryString = new QueryString($"?id={connection.ConnectionId}");
2184
deleteContext.
Request
.Method = "DELETE";
2270
context.
Request
.Path = "/foo";
2271
context.
Request
.Method = "POST";
2273
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
2296
context.
Request
.Path = "/foo";
2297
context.
Request
.Method = "POST";
2299
context.
Request
.QueryString = new QueryString("?negotiateVersion=1&UseStatefulReconnect=true");
2325
context.
Request
.Path = "/foo";
2326
context.
Request
.Method = "POST";
2328
context.
Request
.QueryString = new QueryString("?negotiateVersion=1");
2354
context.
Request
.Path = "/foo";
2355
context.
Request
.Method = "POST";
2357
context.
Request
.QueryString = new QueryString("?negotiateVersion=1&UseStatefulReconnect=true");
2566
context.
Request
.Body = requestBody;
2568
context.
Request
.Path = "/foo";
2569
context.
Request
.Method = "POST";
2574
context.
Request
.Query = qs;
2626
context.
Request
.Body = requestBody;
2628
context.
Request
.Path = "/foo";
2629
context.
Request
.Method = "POST";
2634
context.
Request
.Query = qs;
2683
context.
Request
.Body = requestBody;
2685
context.
Request
.Path = "/foo";
2686
context.
Request
.Method = "POST";
2691
context.
Request
.Query = qs;
2788
deleteContext.
Request
.Path = "/foo";
2789
deleteContext.
Request
.QueryString = new QueryString($"?id={connection.ConnectionId}");
2790
deleteContext.
Request
.Method = "DELETE";
3697
context.
Request
.Path = "/foo";
3698
context.
Request
.Method = "GET";
3703
context.
Request
.Query = qs;
3734
context.
Request
.Path = path;
3735
context.
Request
.Method = "GET";
3744
context.
Request
.Query = qs;
WebSocketsTests.cs (1)
374
context.
Request
.Headers.Add(HeaderNames.WebSocketSubProtocols, providedSubProtocols.ToArray());
Microsoft.AspNetCore.Http.Extensions.Tests (131)
HeaderDictionaryTypeExtensionsTest.cs (46)
14
context.
Request
.Headers.ContentType = "text/plain";
16
var result = context.
Request
.GetTypedHeaders().Get<MediaTypeHeaderValue>(HeaderNames.ContentType);
27
var result = context.
Request
.GetTypedHeaders().Get<MediaTypeHeaderValue>(HeaderNames.ContentType);
36
context.
Request
.Headers.ContentType = "invalid";
38
var result = context.
Request
.GetTypedHeaders().Get<MediaTypeHeaderValue>(HeaderNames.ContentType);
47
context.
Request
.Headers.CacheControl = "max-age=604800";
49
var result = context.
Request
.GetTypedHeaders().Get<CacheControlHeaderValue>(HeaderNames.CacheControl);
59
context.
Request
.Headers.ContentDisposition = "form-data; name=\"fieldName\"";
61
var result = context.
Request
.GetTypedHeaders().Get<ContentDispositionHeaderValue>(HeaderNames.ContentDisposition);
71
context.
Request
.Headers.IfRange = "\"etag1\"";
73
var result = context.
Request
.GetTypedHeaders().Get<RangeConditionHeaderValue>(HeaderNames.IfRange);
83
context.
Request
.Headers.Range = "bytes=0-499";
85
var result = context.
Request
.GetTypedHeaders().Get<RangeHeaderValue>(HeaderNames.Range);
95
context.
Request
.Headers.ETag = "\"123\"";
97
var result = context.
Request
.GetTypedHeaders().Get<EntityTagHeaderValue>(HeaderNames.ETag);
108
context.
Request
.Headers.ETag = expected.ToString("r");
110
var result = context.
Request
.GetTypedHeaders().Get<DateTimeOffset?>(HeaderNames.ETag);
119
context.
Request
.Headers.ETag = $"{int.MaxValue + 1L}";
121
var result = context.
Request
.GetTypedHeaders().Get<long?>(HeaderNames.ETag);
130
context.
Request
.Headers["custom"] = "valid";
132
var result = context.
Request
.GetTypedHeaders().Get<TestHeaderValue>("custom");
140
context.
Request
.Headers["custom"] = "invalid";
142
var result = context.
Request
.GetTypedHeaders().Get<TestHeaderValue>("custom");
151
var result = context.
Request
.GetTypedHeaders().Get<TestHeaderValue>("custom");
159
context.
Request
.Headers["custom"] = "valid";
161
Assert.Throws<NotSupportedException>(() => context.
Request
.GetTypedHeaders().Get<object>("custom"));
168
context.
Request
.Headers.Accept = "text/plain; q=0.9, text/other, */*";
170
var result = context.
Request
.GetTypedHeaders().GetList<MediaTypeHeaderValue>(HeaderNames.Accept);
185
var result = context.
Request
.GetTypedHeaders().GetList<MediaTypeHeaderValue>(HeaderNames.Accept);
194
context.
Request
.Headers.Accept = "invalid";
196
var result = context.
Request
.GetTypedHeaders().GetList<MediaTypeHeaderValue>(HeaderNames.Accept);
205
context.
Request
.Headers.Accept = "text/plain; q=0.5, text/html; q=0.8";
207
var result = context.
Request
.GetTypedHeaders().GetList<StringWithQualityHeaderValue>(HeaderNames.Accept);
217
context.
Request
.Headers.Cookie = "cookie1=a,cookie2=b";
219
var result = context.
Request
.GetTypedHeaders().GetList<CookieHeaderValue>(HeaderNames.Cookie);
229
context.
Request
.Headers.ETag = "\"123\",\"456\"";
231
var result = context.
Request
.GetTypedHeaders().GetList<EntityTagHeaderValue>(HeaderNames.ETag);
241
context.
Request
.Headers.SetCookie = "cookie1=a,cookie2=b";
243
var result = context.
Request
.GetTypedHeaders().GetList<SetCookieHeaderValue>(HeaderNames.SetCookie);
253
context.
Request
.Headers["custom"] = "valid";
255
var results = context.
Request
.GetTypedHeaders().GetList<TestHeaderValue>("custom");
264
context.
Request
.Headers["custom"] = "invalid";
266
var results = context.
Request
.GetTypedHeaders().GetList<TestHeaderValue>("custom");
275
var results = context.
Request
.GetTypedHeaders().GetList<TestHeaderValue>("custom");
283
context.
Request
.Headers["custom"] = "valid";
285
Assert.Throws<NotSupportedException>(() => context.
Request
.GetTypedHeaders().GetList<object>("custom"));
HttpRequestJsonExtensionsTests.cs (39)
28
var request = new DefaultHttpContext().
Request
;
39
context.
Request
.ContentType = "text/json";
42
var ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await context.
Request
.ReadFromJsonAsync<int>());
54
context.
Request
.ContentType = "application/json";
57
var ex = await Assert.ThrowsAsync<JsonException>(async () => await context.
Request
.ReadFromJsonAsync<int>());
69
context.
Request
.ContentType = "application/json";
70
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("1"));
73
var result = await context.
Request
.ReadFromJsonAsync<int>();
84
context.
Request
.ContentType = "application/json";
85
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("[1,2,]"));
91
var result = await context.
Request
.ReadFromJsonAsync<List<int>>(options);
105
context.
Request
.ContentType = "application/json; charset=utf-8";
106
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("[1,2]"));
109
var result = await context.
Request
.ReadFromJsonAsync<List<int>>();
123
context.
Request
.ContentType = "application/json; charset=utf-16";
124
context.
Request
.Body = new MemoryStream(Encoding.Unicode.GetBytes(@"{""name"": ""激光這兩個字是甚麼意思""}"));
127
var result = await context.
Request
.ReadFromJsonAsync<Dictionary<string, string>>();
138
context.
Request
.ContentType = "application /json";
139
context.
Request
.Body = new TestStream();
144
var readTask = context.
Request
.ReadFromJsonAsync<List<int>>(cts.Token);
158
context.
Request
.ContentType = "application/json; charset=invalid";
161
var ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await context.
Request
.ReadFromJsonAsync<object>());
172
context.
Request
.ContentType = "application/json";
173
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("1"));
176
var result = (int?)await context.
Request
.ReadFromJsonAsync(typeof(int));
187
context.
Request
.ContentType = "application/json; charset=utf-16";
188
context.
Request
.Body = new MemoryStream(Encoding.Unicode.GetBytes(@"{""name"": ""激光這兩個字是甚麼意思""}"));
191
var result = (Dictionary<string, string>?)await context.
Request
.ReadFromJsonAsync(typeof(Dictionary<string, string>));
202
context.
Request
.ContentType = "application/json; charset=invalid";
205
var ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await context.
Request
.ReadFromJsonAsync(typeof(object)));
216
context.
Request
.ContentType = "application/json";
217
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("[1,2,]"));
223
var result = (List<int>?)await context.
Request
.ReadFromJsonAsync(typeof(List<int>), options);
237
context.
Request
.ContentType = "application/json";
238
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("[1,2,]"));
245
var result = (List<int>?)await context.
Request
.ReadFromJsonAsync(options.GetTypeInfo(typeof(List<int>)));
259
context.
Request
.ContentType = "application/json";
260
context.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("[1,2,]"));
268
var result = await context.
Request
.ReadFromJsonAsync(typeInfo);
ProblemDetailsDefaultWriterTest.cs (1)
686
context.
Request
.Headers.Accept = contentType;
RequestDelegateFactoryTests.cs (35)
251
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
255
httpContext.
Request
.RouteValues = new()
582
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
604
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
628
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
633
httpContext.
Request
.Headers["Custom"] = new(new[] { "4", "5", "6" });
635
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
663
httpContext.
Request
.Form = new FormCollection(null);
692
httpContext.
Request
.Headers.Referer = "https://example.org";
753
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>()
852
httpContext.
Request
.Body = stream;
854
httpContext.
Request
.Headers["Content-Type"] = "application/json";
855
httpContext.
Request
.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
887
httpContext.
Request
.Headers["Content-Type"] = "application/json";
888
httpContext.
Request
.Headers["Content-Length"] = "0";
1274
Assert.Equal(httpContext.
Request
, httpRequestArgument);
1564
httpContext.
Request
.RouteValues[paramName] = routeParam;
1667
httpContext.
Request
.Headers.Referer = "https://example.org";
1777
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1807
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1837
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1865
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1905
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
1934
httpContext.
Request
.Headers["Content-Type"] = "application/x-www-form-urlencoded";
1935
httpContext.
Request
.Headers["Content-Length"] = "1";
1936
httpContext.
Request
.Body = new ExceptionThrowingRequestBodyStream(exception);
1967
httpContext.
Request
.Headers["Content-Type"] = "application/json";
1968
httpContext.
Request
.Headers["Content-Length"] = "1000";
1969
httpContext.
Request
.Body = new ExceptionThrowingRequestBodyStream(exception);
2160
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
2197
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
2877
httpContext.
Request
.Body = stream;
2879
httpContext.
Request
.Headers["Content-Type"] = "application/json";
2880
httpContext.
Request
.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
3107
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
RequestDelegateFactoryTests.FormMapping.cs (8)
32
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
79
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
127
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
160
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
183
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
213
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
252
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>
297
httpContext.
Request
.Form = new FormCollection(new() { { "Description", "A test file" } }, formFiles);
UriHelperTests.cs (2)
86
var request = new DefaultHttpContext().
Request
;
101
var request = new DefaultHttpContext().
Request
;
Microsoft.AspNetCore.Http.Results.Tests (9)
CreatedAtRouteOfTResultTests.cs (1)
182
httpContext.
Request
.PathBase = new PathString("");
CreatedAtRouteResultTests.cs (1)
128
httpContext.
Request
.PathBase = new PathString("");
CreatedOfTResultTests.cs (1)
179
httpContext.
Request
.PathBase = new PathString("");
CreatedResultTests.cs (1)
116
httpContext.
Request
.PathBase = new PathString("");
EmptyResultTests.cs (1)
40
httpContext.
Request
.PathBase = new PathString("");
LocalRedirectResultTests.cs (1)
132
httpContext.
Request
.PathBase = new PathString(appRoot);
NotFoundOfTResultTests.cs (1)
142
httpContext.
Request
.PathBase = new PathString("");
NotFoundResultTests.cs (1)
91
httpContext.
Request
.PathBase = new PathString("");
src\Shared\ResultsTests\RedirectResultTestBase.cs (1)
74
httpContext.
Request
.PathBase = new PathString(appRoot);
Microsoft.AspNetCore.Http.Tests (118)
ApplicationBuilderTests.cs (7)
90
httpContext.
Request
.Protocol = "HTTP/2";
91
httpContext.
Request
.Scheme = "https";
92
httpContext.
Request
.Method = "GET";
93
httpContext.
Request
.Host = new HostString("localhost:5000");
94
httpContext.
Request
.Path = "/path";
95
httpContext.
Request
.PathBase = "/pathbase";
96
httpContext.
Request
.QueryString = new QueryString("?query=true");
DefaultHttpContextTests.cs (3)
298
context.
Request
.Method = "GET";
308
context.
Request
.Protocol = "HTTP/2";
318
context.
Request
.ContentType = "application/json";
Features\FormFeatureTests.cs (71)
17
context.
Request
.ContentType = MultipartContentType;
18
context.
Request
.ContentLength = 0;
20
var formFeature = new FormFeature(context.
Request
, new FormOptions());
23
var formCollection = await context.
Request
.ReadFormAsync();
32
context.
Request
.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
39
context.
Request
.Body = new NonSeekableReadStream(formContent);
41
var exception = await Assert.ThrowsAsync<InvalidDataException>(() => context.
Request
.ReadFormAsync());
55
context.
Request
.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
56
context.
Request
.Body = new NonSeekableReadStream(formContent);
58
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
61
var formCollection = await context.
Request
.ReadFormAsync();
65
Assert.Equal(bufferRequest, context.
Request
.Body.CanSeek);
68
Assert.Equal(0, context.
Request
.Body.Position);
90
context.
Request
.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
100
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
103
var formCollection = await context.
Request
.ReadFormAsync();
205
context.
Request
.ContentType = MultipartContentType;
206
context.
Request
.Body = new NonSeekableReadStream(formContent);
208
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
211
var formCollection = context.
Request
.Form;
220
Assert.Same(formCollection, await context.
Request
.ReadFormAsync());
240
context.
Request
.ContentType = MultipartContentType;
241
context.
Request
.Body = new NonSeekableReadStream(formContent);
243
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
246
var formCollection = context.
Request
.Form;
255
Assert.Same(formCollection, await context.
Request
.ReadFormAsync());
277
context.
Request
.ContentType = MultipartContentType;
278
context.
Request
.Body = new NonSeekableReadStream(formContent);
280
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
283
var formCollection = await context.
Request
.ReadFormAsync();
292
Assert.Same(formCollection, context.
Request
.Form);
325
context.
Request
.ContentType = MultipartContentTypeWithSpecialCharacters;
326
context.
Request
.Body = new NonSeekableReadStream(formContent);
328
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
331
var formCollection = context.
Request
.Form;
340
Assert.Same(formCollection, await context.
Request
.ReadFormAsync());
362
context.
Request
.ContentType = MultipartContentType;
363
context.
Request
.Body = new NonSeekableReadStream(formContent);
365
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
368
var formCollection = await context.
Request
.ReadFormAsync();
377
Assert.Same(formCollection, context.
Request
.Form);
410
context.
Request
.ContentType = MultipartContentType;
411
context.
Request
.Body = new NonSeekableReadStream(formContent);
413
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
416
var formCollection = await context.
Request
.ReadFormAsync();
425
Assert.Same(formCollection, context.
Request
.Form);
462
context.
Request
.ContentType = MultipartContentType;
463
context.
Request
.Body = new NonSeekableReadStream(formContent.ToArray());
465
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest, ValueCountLimit = 2 });
468
var exception = await Assert.ThrowsAsync<InvalidDataException>(() => context.
Request
.ReadFormAsync());
486
context.
Request
.ContentType = MultipartContentType;
487
context.
Request
.Body = new NonSeekableReadStream(formContent.ToArray());
489
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest, ValueCountLimit = 2 });
492
var exception = await Assert.ThrowsAsync<InvalidDataException>(() => context.
Request
.ReadFormAsync());
510
context.
Request
.ContentType = MultipartContentType;
511
context.
Request
.Body = new NonSeekableReadStream(formContent.ToArray());
513
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest, ValueCountLimit = 2 });
516
var exception = await Assert.ThrowsAsync<InvalidDataException>(() => context.
Request
.ReadFormAsync());
534
context.
Request
.ContentType = MultipartContentType;
535
context.
Request
.Body = new NonSeekableReadStream(formContent.ToArray());
537
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest, ValueCountLimit = 2 });
540
var exception = await Assert.ThrowsAsync<InvalidDataException>(() => context.
Request
.ReadFormAsync());
559
context.
Request
.ContentType = MultipartContentType;
560
context.
Request
.Body = new NonSeekableReadStream(formContent);
562
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions() { BufferBody = bufferRequest });
565
var formCollection = await context.
Request
.ReadFormAsync();
574
Assert.Same(formCollection, context.
Request
.Form);
602
context.
Request
.ContentType = MultipartContentType;
603
context.
Request
.Body = new NonSeekableReadStream(formContent);
605
IFormFeature formFeature = new FormFeature(context.
Request
, new FormOptions());
608
var exception = await Assert.ThrowsAsync<InvalidDataException>(() => context.
Request
.ReadFormAsync());
Features\RequestBodyPipeFeatureTests.cs (4)
18
context.
Request
.Body = expectedStream;
31
context.
Request
.Body = new MemoryStream(Encoding.ASCII.GetBytes("hahaha"));
36
context.
Request
.Body = new MemoryStream(Encoding.ASCII.GetBytes(expectedString));
56
context.
Request
.Body = mockStream.Object;
Internal\DefaultHttpRequestTests.cs (33)
121
var request = new DefaultHttpContext().
Request
;
137
var request = new DefaultHttpContext().
Request
;
166
var request = new DefaultHttpContext().
Request
;
200
var request = context.
Request
;
246
var bodyPipe = context.
Request
.BodyReader;
255
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
263
context.
Request
.Method = "GET";
265
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
273
context.
Request
.Protocol = "HTTP/2";
275
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
283
context.
Request
.ContentType = "application/json";
285
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
293
context.
Request
.QueryString = new QueryString("?query=true");
295
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
303
context.
Request
.Scheme = "http";
304
context.
Request
.Host = new HostString("localhost", 8080);
305
context.
Request
.Path = "/Path";
306
context.
Request
.PathBase = "/PathBase";
307
context.
Request
.QueryString = new QueryString("?test=true");
309
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
317
context.
Request
.Scheme = "http";
318
context.
Request
.Host = new HostString("localhost");
320
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
328
context.
Request
.Method = "GET";
329
context.
Request
.Protocol = "HTTP/2";
330
context.
Request
.ContentType = "application/json";
331
context.
Request
.Scheme = "http";
332
context.
Request
.Host = new HostString("localhost", 8080);
333
context.
Request
.Path = "/Path";
334
context.
Request
.PathBase = "/PathBase";
335
context.
Request
.QueryString = new QueryString("?test=true");
337
var debugText = HttpContextDebugFormatter.RequestToString(context.
Request
);
350
return context.
Request
;
Microsoft.AspNetCore.HttpLogging.Tests (65)
HttpLoggingMiddlewareTests.cs (47)
260
httpContext.
Request
.Headers["foo"] = "bar";
278
httpContext.
Request
.Headers["Connection"] = "keep-alive";
280
httpContext.
Request
.Headers["foo"] = "bar";
298
httpContext.
Request
.ContentType = "text/plain";
299
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("Hello World"));
329
httpContext.
Request
.ContentType = "text/plain";
330
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(expected));
357
httpContext.
Request
.ContentType = "text/plain";
358
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(expected));
385
httpContext.
Request
.ContentType = "text/plain";
386
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(expected));
421
httpContext.
Request
.ContentType = "text/plain";
422
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(input));
457
httpContext.
Request
.ContentType = "text/plain";
458
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(input));
482
httpContext.
Request
.ContentType = "text/plain";
483
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(input));
508
httpContext.
Request
.ContentType = "text/plain";
509
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(input));
547
httpContext.
Request
.ContentType = contentType;
548
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(expected));
587
httpContext.
Request
.ContentType = contentType;
588
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes(expected));
626
httpContext.
Request
.ContentType = "text/plain";
627
httpContext.
Request
.Body = new MemoryStream(encoding.GetBytes(expected));
664
httpContext.
Request
.ContentType = "text/plain; charset=" + Encoding.ASCII.WebName;
665
httpContext.
Request
.Body = new MemoryStream(Encoding.ASCII.GetBytes(expected));
703
httpContext.
Request
.ContentType = "text/plain; charset=" + Encoding.UTF32.WebName;
704
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF32.GetBytes(expected));
1187
httpContext.
Request
.Headers.Remove(HeaderNames.ContentType);
1248
httpContext.
Request
.Protocol = "HTTP/1.1";
1249
httpContext.
Request
.Method = "GET";
1250
httpContext.
Request
.Scheme = "http";
1251
httpContext.
Request
.Path = "/";
1252
httpContext.
Request
.Headers.Connection = HeaderNames.Upgrade;
1253
httpContext.
Request
.Headers.Upgrade = "websocket";
1523
httpContext.
Request
.ContentType = null;
1524
httpContext.
Request
.Body = Stream.Null;
1956
httpContext.
Request
.Protocol = "HTTP/1.0";
1957
httpContext.
Request
.Method = "GET";
1958
httpContext.
Request
.Scheme = "http";
1959
httpContext.
Request
.Path = new PathString("/foo");
1960
httpContext.
Request
.PathBase = new PathString("/foo");
1961
httpContext.
Request
.QueryString = new QueryString("?foo");
1962
httpContext.
Request
.Headers["Connection"] = "keep-alive";
1963
httpContext.
Request
.ContentType = "text/plain";
1964
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("test"));
W3CLoggingMiddlewareTests.cs (18)
55
httpContext.
Request
.Protocol = "HTTP/1.0";
56
httpContext.
Request
.Method = "GET";
57
httpContext.
Request
.Path = new PathString("/foo");
58
httpContext.
Request
.QueryString = new QueryString("?foo");
59
httpContext.
Request
.Headers["Referer"] = "bar";
82
httpContext.
Request
.Protocol = "HTTP/1.0";
83
httpContext.
Request
.Headers["Cookie"] = "Snickerdoodle";
126
httpContext.
Request
.Protocol = "HTTP/1.0";
127
httpContext.
Request
.Headers["Cookie"] = "Snickerdoodle";
128
httpContext.
Request
.Headers["x-forwarded-for"] = "1.3.3.7, 2001:db8:85a3:8d3:1319:8a2e:370:7348";
168
httpContext.
Request
.Protocol = "HTTP/1.0";
169
httpContext.
Request
.Headers["Cookie"] = "Snickerdoodle";
199
httpContext.
Request
.Protocol = "HTTP/1.0";
200
httpContext.
Request
.Headers["Cookie"] = "Snickerdoodle";
201
httpContext.
Request
.Headers["x-forwarded-for"] = "1.3.3.7, 2001:db8:85a3:8d3:1319:8a2e:370:7348";
246
httpContext.
Request
.Protocol = "HTTP/1.0";
247
httpContext.
Request
.Headers["Cookie"] = "Snickerdoodle";
248
httpContext.
Request
.Headers["x-forwarded-for"] = "1.3.3.7, 2001:db8:85a3:8d3:1319:8a2e:370:7348";
Microsoft.AspNetCore.Mvc.Core.Test (102)
ActionConstraints\HttpMethodActionConstraintTest.cs (3)
72
httpContext.
Request
.Method = requestedMethod;
76
httpContext.
Request
.Headers.Add("Origin", StringValues.Empty);
77
httpContext.
Request
.Headers.Add("Access-Control-Request-Method", accessControlMethod);
ConsumesAttributeTests.cs (4)
301
httpContext.
Request
.ContentType = contentType;
331
httpContext.
Request
.ContentType = contentType;
360
httpContext.
Request
.ContentType = contentType;
423
httpContext.
Request
.ContentType = contentType;
CreatedAtActionResultTests.cs (1)
78
httpContext.
Request
.PathBase = new PathString("");
CreatedAtRouteResultTests.cs (1)
92
httpContext.
Request
.PathBase = new PathString("");
CreatedResultTests.cs (1)
125
httpContext.
Request
.PathBase = new PathString("");
FileResultHelperTest.cs (8)
248
httpContext.
Request
.Method = HttpMethods.Get;
249
var httpRequestHeaders = httpContext.
Request
.GetTypedHeaders();
289
httpContext.
Request
.Method = HttpMethods.Delete;
290
var httpRequestHeaders = httpContext.
Request
.GetTypedHeaders();
326
httpContext.
Request
.Method = HttpMethods.Get;
327
var httpRequestHeaders = httpContext.
Request
.GetTypedHeaders();
362
httpContext.
Request
.Method = HttpMethods.Get;
363
var httpRequestHeaders = httpContext.
Request
.GetTypedHeaders();
Formatters\InputFormatterTest.cs (9)
35
httpContext.
Request
.ContentType = requestContentType;
69
httpContext.
Request
.ContentType = requestContentType;
100
httpContext.
Request
.ContentType = requestContentType;
134
httpContext.
Request
.ContentType = requestContentType;
165
httpContext.
Request
.ContentType = requestContentType;
202
httpContext.
Request
.ContentType = requestContentType;
232
httpContext.
Request
.ContentType = requestContentType;
270
httpContext.
Request
.ContentType = requestContentType;
299
httpContext.
Request
.ContentType = requestContentType;
Formatters\JsonInputFormatterTestBase.cs (3)
641
httpContext.
Request
.Body = requestStream;
642
httpContext.
Request
.ContentType = contentType;
643
httpContext.
Request
.ContentLength = requestStream.Length;
Formatters\JsonOutputFormatterTestBase.cs (2)
167
httpContext.
Request
.ContentType = contentType.ToString();
168
httpContext.
Request
.Headers.AcceptCharset = contentType.Charset.ToString();
Formatters\TextOutputFormatterTests.cs (2)
42
var httpRequest = new DefaultHttpContext().
Request
;
242
context.
Request
.Headers.AcceptCharset = expectedValue;
HttpNotFoundObjectResultTest.cs (1)
58
httpContext.
Request
.PathBase = new PathString("");
Infrastructure\ActionSelectorTest.cs (1)
1026
httpContext.
Request
.Method = httpMethod;
Infrastructure\ObjectResultExecutorTest.cs (5)
26
httpContext.
Request
.Headers.Accept = "application/xml"; // This will not be used
54
httpContext.
Request
.Headers.Accept = "application/xml"; // This will not be used
77
httpContext.
Request
.Headers.Accept = "application/xml"; // This will not be used
189
httpContext.
Request
.Headers.Accept = "application/json"; // This will not be used
215
httpContext.
Request
.Headers.Accept = "application/xml"; // This will not be used
LocalRedirectResultTest.cs (1)
150
httpContext.
Request
.PathBase = new PathString(appRoot);
ModelBinding\Binders\BodyModelBinderTests.cs (17)
253
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("Bad data!"));
254
httpContext.
Request
.ContentType = "text/xyz";
301
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("Bad data!"));
302
httpContext.
Request
.ContentType = "application/xml";
330
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("Bad data!"));
331
httpContext.
Request
.ContentType = "application/json";
372
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("Bad data!"));
373
httpContext.
Request
.ContentType = "application/xml";
401
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("Bad data!"));
402
httpContext.
Request
.ContentType = "application/json";
448
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("valid data!"));
449
httpContext.
Request
.ContentType = contentType;
483
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("valid data!"));
484
httpContext.
Request
.ContentType = contentType;
512
httpContext.
Request
.Body = new MemoryStream(Encoding.UTF8.GetBytes("valid data"));
513
httpContext.
Request
.ContentType = "text/xyz";
536
httpContext.
Request
.ContentType = "text/xyz";
ModelBinding\FormFileValueProviderFactoryTest.cs (2)
116
context.
Request
.ContentType = contentType;
117
context.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>(), new FormFileCollection());
ModelBinding\FormFileValueProviderTest.cs (6)
16
httpContext.
Request
.ContentType = "multipart/form-data";
19
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>(), formFiles);
35
httpContext.
Request
.ContentType = "multipart/form-data";
38
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>(), formFiles);
54
httpContext.
Request
.ContentType = "multipart/form-data";
57
httpContext.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>(), formFiles);
ModelBinding\FormValueProviderFactoryTest.cs (3)
104
context.
Request
.ContentType = contentType;
106
if (context.
Request
.HasFormContentType)
108
context.
Request
.Form = new FormCollection(new Dictionary<string, StringValues>());
ModelBinding\JQueryFormValueProviderFactoryTest.cs (3)
189
context.
Request
.ContentType = contentType;
191
if (context.
Request
.HasFormContentType)
193
context.
Request
.Form = new FormCollection(formValues ?? new Dictionary<string, StringValues>());
ModelBinding\JQueryQueryStringValueProviderFactoryTest.cs (1)
117
context.
Request
.Query = new QueryCollection(queryStringValues);
ModelBinding\QueryStringValueProviderFactoryTest.cs (1)
36
context.
Request
.Query = new QueryCollection(queryValues);
RequireHttpsAttributeTests.cs (17)
20
requestContext.
Request
.Scheme = "https";
71
requestContext.
Request
.Scheme = "http";
72
requestContext.
Request
.Method = "GET";
73
requestContext.
Request
.Host = HostString.FromUriComponent(host);
77
requestContext.
Request
.PathBase = new PathString(pathBase);
82
requestContext.
Request
.Path = new PathString(path);
87
requestContext.
Request
.QueryString = new QueryString(queryString);
114
requestContext.
Request
.Scheme = "http";
115
requestContext.
Request
.Method = method;
134
requestContext.
Request
.Scheme = "http";
173
requestContext.
Request
.Scheme = "http";
174
requestContext.
Request
.Method = "GET";
175
requestContext.
Request
.Host = HostString.FromUriComponent(uri);
176
requestContext.
Request
.Path = PathString.FromUriComponent(uri);
177
requestContext.
Request
.QueryString = QueryString.FromUriComponent(uri);
201
requestContext.
Request
.Scheme = "http";
202
requestContext.
Request
.Method = "GET";
Routing\AttributeRouteTest.cs (1)
81
httpContext.
Request
.Path = new PathString("/api/Store/Buy/5");
Routing\ControllerLinkGeneratorExtensionsTest.cs (1)
233
httpContext.
Request
.RouteValues = new RouteValueDictionary(ambientValues);
Routing\PageLinkGeneratorExtensionsTest.cs (1)
203
httpContext.
Request
.RouteValues = new RouteValueDictionary(ambientValues);
Routing\UrlHelperBaseTest.cs (3)
125
context.
Request
.PathBase = new PathString(appRoot);
126
context.
Request
.Host = new HostString(host);
127
context.
Request
.Scheme = protocol;
Routing\UrlHelperTestBase.cs (3)
1152
context.
Request
.PathBase = new PathString(appRoot);
1153
context.
Request
.Host = new HostString(host);
1154
context.
Request
.Scheme = protocol;
src\Shared\ResultsTests\RedirectResultTestBase.cs (1)
74
httpContext.
Request
.PathBase = new PathString(appRoot);
Microsoft.AspNetCore.Mvc.Cors.Test (16)
CorsAuthorizationFilterTest.cs (5)
138
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestHeaders, headers.Headers.Split(','));
139
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, new[] { headers.Method });
140
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlExposeHeaders, headers.ExposedHeaders.Split(','));
141
httpContext.
Request
.Headers.Add(CorsConstants.Origin, new[] { headers.Origin });
149
httpContext.
Request
.Method = method;
CorsHttpMethodActionConstraintTest.cs (3)
88
httpContext.
Request
.Method = requestedMethod;
92
httpContext.
Request
.Headers.Add("Origin", StringValues.Empty);
95
httpContext.
Request
.Headers.Add("Access-Control-Request-Method", accessControlMethod);
DisableCorsAuthorizationFilterTest.cs (8)
20
httpContext.
Request
.Method = "GET";
21
httpContext.
Request
.Headers.Add(CorsConstants.Origin, "http://localhost:5000/");
22
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, "PUT");
40
httpContext.
Request
.Method = "OPTIONS";
41
httpContext.
Request
.Headers.Add(CorsConstants.Origin, "http://localhost:5000/");
61
httpContext.
Request
.Method = preflightMethod;
62
httpContext.
Request
.Headers.Add(CorsConstants.Origin, "http://localhost:5000/");
63
httpContext.
Request
.Headers.Add(CorsConstants.AccessControlRequestMethod, "PUT");
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (24)
XmlDataContractSerializerInputFormatterTest.cs (11)
149
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: true);
150
httpContext.
Request
.ContentType = "application/json";
181
httpContext.
Request
.Body = testBufferedReadStream;
213
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
214
httpContext.
Request
.ContentType = "application/xml";
248
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: false);
249
httpContext.
Request
.ContentType = "application/json";
280
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
281
httpContext.
Request
.ContentType = "application/xml";
339
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
340
httpContext.
Request
.ContentType = "application/xml";
XmlDataContractSerializerOutputFormatterTest.cs (1)
803
var request = httpContext.
Request
;
XmlSerializerInputFormatterTest.cs (11)
54
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: true);
55
httpContext.
Request
.ContentType = "application/json";
91
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
92
httpContext.
Request
.ContentType = "application/xml";
127
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: false);
128
httpContext.
Request
.ContentType = "application/json";
163
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
164
httpContext.
Request
.ContentType = "application/xml";
205
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
206
httpContext.
Request
.ContentType = "application/xml";
636
httpContext.
Request
.Body = testBufferedReadStream;
XmlSerializerOutputFormatterTest.cs (1)
585
var request = httpContext.
Request
;
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
ModelBindingTestHelper.cs (1)
156
updateRequest?.Invoke(httpContext.
Request
);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (21)
NewtonsoftJsonInputFormatterTest.cs (11)
41
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: false);
42
httpContext.
Request
.ContentType = "application/json";
77
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
78
httpContext.
Request
.ContentType = "application/json";
113
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
114
httpContext.
Request
.ContentType = "application/json";
130
Assert.False(httpContext.
Request
.Body.CanSeek);
505
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: false);
506
httpContext.
Request
.ContentType = "application/json";
548
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: false);
549
httpContext.
Request
.ContentType = "application/json";
NewtonsoftJsonPatchInputFormatterTest.cs (5)
40
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes, allowSyncReads: false);
41
httpContext.
Request
.ContentType = "application/json";
77
httpContext.
Request
.Body = new NonSeekableReadStream(contentBytes);
78
httpContext.
Request
.ContentType = "application/json";
95
Assert.False(httpContext.
Request
.Body.CanSeek);
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (3)
641
httpContext.
Request
.Body = requestStream;
642
httpContext.
Request
.ContentType = contentType;
643
httpContext.
Request
.ContentLength = requestStream.Length;
src\Mvc\Mvc.Core\test\Formatters\JsonOutputFormatterTestBase.cs (2)
167
httpContext.
Request
.ContentType = contentType.ToString();
168
httpContext.
Request
.Headers.AcceptCharset = contentType.Charset.ToString();
Microsoft.AspNetCore.Mvc.RazorPages.Test (3)
Infrastructure\PageBinderFactoryTest.cs (1)
795
httpContext.
Request
.Method = httpMethod;
PageModelTest.cs (1)
1745
Assert.Same(httpContext.
Request
, pageModel.Request);
PageTest.cs (1)
45
Assert.Same(httpContext.
Request
, page.Request);
Microsoft.AspNetCore.Mvc.Test (1)
Routing\ActionConstraintMatcherPolicyTest.cs (1)
467
httpContext.
Request
.Method = httpMethod;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (11)
CookieTempDataProviderTest.cs (11)
40
httpContext.
Request
.PathBase = "/";
82
context.
Request
.Headers.Cookie = $"{CookieTempDataProvider.CookieName}={base64AndUrlEncodedDataInCookie}";
104
httpContext.
Request
.Headers.Cookie = $"{CookieTempDataProvider.CookieName}={base64AndUrlEncodedDataInCookie}";
126
httpContext.
Request
.PathBase = "/";
161
httpContext.
Request
.PathBase = "/";
163
httpContext.
Request
.IsHttps = isRequestSecure;
197
httpContext.
Request
.PathBase = pathBase;
246
httpContext.
Request
.PathBase = requestPathBase;
276
httpContext.
Request
.PathBase = "/";
277
httpContext.
Request
.Headers.Cookie = requestCookies;
316
context.
Request
.PathBase = "/";
Microsoft.AspNetCore.OpenApi.Tests (3)
Extensions\OpenApiEndpointRouteBuilderExtensionsTests.cs (3)
61
context.
Request
.RouteValues.Add("documentName", "v1");
123
context.
Request
.RouteValues.Add("documentName", "v2");
152
context.
Request
.QueryString = new QueryString($"?documentName={documentName}");
Microsoft.AspNetCore.RateLimiting.Tests (6)
RateLimitingMetricsTests.cs (6)
83
context.
Request
.Method = "GET";
142
context.
Request
.Method = "GET";
208
context1.
Request
.Method = "GET";
216
context2.
Request
.Method = "GET";
277
context1.
Request
.Method = "GET";
285
context2.
Request
.Method = "GET";
Microsoft.AspNetCore.RequestDecompression.Microbenchmarks (1)
RequestDecompressionMiddlewareBenchmark.cs (1)
40
context.
Request
.Headers.ContentEncoding = "gzip";
Microsoft.AspNetCore.RequestDecompression.Tests (7)
DefaultRequestDecompressionProviderTests.cs (7)
29
httpContext.
Request
.Headers.Add(HeaderNames.ContentEncoding, contentEncoding);
47
var contentEncodingHeader = httpContext.
Request
.Headers.ContentEncoding;
72
var contentEncodingHeader = httpContext.
Request
.Headers.ContentEncoding;
82
httpContext.
Request
.Headers.Add(HeaderNames.ContentEncoding, contentEncoding);
99
var contentEncodingHeader = httpContext.
Request
.Headers.ContentEncoding;
110
httpContext.
Request
.Headers.Add(HeaderNames.ContentEncoding, contentEncodings);
127
var contentEncodingHeader = httpContext.
Request
.Headers.ContentEncoding;
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (5)
ResponseCachingBenchmark.cs (5)
57
context.
Request
.Method = HttpMethods.Get;
58
context.
Request
.Path = "/a";
61
context.
Request
.Headers.CacheControl = CacheControlHeaderValue.NoCacheString;
75
context.
Request
.Method = HttpMethods.Get;
76
context.
Request
.Path = "/b";
Microsoft.AspNetCore.ResponseCompression.Microbenchmarks (1)
ResponseCompressionProviderBenchmark.cs (1)
51
context.
Request
.Headers.AcceptEncoding = AcceptEncoding;
Microsoft.AspNetCore.Rewrite.Tests (17)
IISUrlRewrite\ServerVariableTests.cs (12)
138
context.
Request
.Method = HttpMethods.Get;
139
context.
Request
.Scheme = "http";
140
context.
Request
.Host = new HostString("example.com");
141
context.
Request
.Path = PathString.FromUriComponent("/foo");
142
context.
Request
.QueryString = QueryString.FromUriComponent("?bar=1");
143
context.
Request
.ContentLength = 10;
144
context.
Request
.ContentType = "json";
145
context.
Request
.Headers.Accept = "accept";
146
context.
Request
.Headers.Cookie = "cookie";
147
context.
Request
.Headers.Referer = "referer";
148
context.
Request
.Headers.UserAgent = "useragent";
149
context.
Request
.Headers.Connection = "connection";
PatternSegments\ServerNameSegmentTests.cs (2)
21
httpContext.
Request
.Host = new HostString(host, port);
22
httpContext.
Request
.Path = new PathString("/foo/bar");
PatternSegments\UrlSegmentTests.cs (3)
29
httpContext.
Request
.Scheme = scheme;
30
httpContext.
Request
.Host = new HostString(host, port);
31
httpContext.
Request
.Path = new PathString(path);
Microsoft.AspNetCore.Routing.Microbenchmarks (3)
EndpointRoutingBenchmarkBase.cs (2)
130
context.
Request
.RouteValues = new RouteValueDictionary(ambientValues);
132
return (context, context.
Request
.RouteValues);
Matching\HttpMethodPolicyJumpTableBenchmark.cs (1)
28
_httpContext.
Request
.Method = TestHttpMethod;
Microsoft.AspNetCore.Routing.Tests (53)
Builder\GroupTest.cs (5)
46
httpContext.
Request
.RouteValues["id"] = "42";
78
httpContext.
Request
.RouteValues["org"] = "dotnet";
79
httpContext.
Request
.RouteValues["id"] = "42";
112
httpContext.
Request
.RouteValues["org"] = "dotnet";
113
httpContext.
Request
.RouteValues["id"] = "42";
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (1)
249
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (11)
160
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
198
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>()
202
httpContext.
Request
.RouteValues = new();
203
httpContext.
Request
.RouteValues["id"] = "42";
538
httpContext.
Request
.RouteValues["id"] = "13";
580
httpContext.
Request
.Query = new QueryCollection(new Dictionary<string, StringValues>
616
httpContext.
Request
.RouteValues["value"] = "42";
640
httpContext.
Request
.RouteValues["id"] = "42";
822
httpContext.
Request
.RouteValues["id"] = "invalid!";
849
httpContext.
Request
.RouteValues["id"] = "invalid!";
897
httpContext.
Request
.RouteValues["id"] = "2";
Constraints\HttpMethodRouteConstraintTests.cs (2)
20
httpContext.
Request
.Method = httpMethod;
41
httpContext.
Request
.Method = httpMethod;
LinkGeneratorTestBase.cs (1)
17
httpContext.
Request
.RouteValues = new RouteValueDictionary(ambientValues);
Matching\AcceptsMatcherPolicyTest.cs (1)
304
httpContext.
Request
.ContentType = contentType;
Matching\ContentEncodingNegotiationMatcherPolicyTest.cs (22)
80
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip, br";
100
httpContext.
Request
.Headers["Accept-Encoding"] = "br";
120
httpContext.
Request
.Headers["Accept-Encoding"] = "br";
140
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0";
160
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0";
180
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip, br";
199
httpContext.
Request
.Headers["Accept-Encoding"] = "zstd";
220
httpContext.
Request
.Headers["Accept-Encoding"] = "zstd";
241
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip, br";
260
httpContext.
Request
.Headers["Accept-Encoding"] = "br, gzip";
279
httpContext.
Request
.Headers["Accept-Encoding"] = "identity";
298
httpContext.
Request
.Headers["Accept-Encoding"] = "identity";
317
httpContext.
Request
.Headers["Accept-Encoding"] = "";
449
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip, br";
467
httpContext.
Request
.Headers["Accept-Encoding"] = "br";
485
httpContext.
Request
.Headers["Accept-Encoding"] = "br";
503
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0";
521
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0";
539
httpContext.
Request
.Headers["Accept-Encoding"] = "gzip, br";
557
httpContext.
Request
.Headers["Accept-Encoding"] = "identity";
575
httpContext.
Request
.Headers["Accept-Encoding"] = "identity";
593
httpContext.
Request
.Headers["Accept-Encoding"] = "";
Matching\HostMatcherPolicyIntegrationTestBase.cs (3)
392
httpContext.
Request
.Host = new HostString(host);
394
httpContext.
Request
.Path = path;
395
httpContext.
Request
.Scheme = scheme;
Matching\HttpMethodMatcherPolicyIntegrationTestBase.cs (4)
369
httpContext.
Request
.Method = corsPreflight ? PreflightHttpMethod : httpMethod;
370
httpContext.
Request
.Path = path;
374
httpContext.
Request
.Headers[HeaderNames.Origin] = "example.com";
375
httpContext.
Request
.Headers[HeaderNames.AccessControlRequestMethod] = httpMethod;
Matching\MatcherConformanceTest.cs (2)
17
httpContext.
Request
.Method = "TEST";
18
httpContext.
Request
.Path = path;
RouterMiddlewareTest.cs (1)
27
httpContext.
Request
.Path = "/foo/10";
Microsoft.AspNetCore.SignalR.Tests (1)
HubConnectionHandlerTests.cs (1)
5093
httpContext.
Request
.QueryString = new QueryString($"?client={client1.Connection.ConnectionId}");
Microsoft.AspNetCore.SpaServices.Extensions.Tests (3)
SpaProxyTests.cs (3)
34
context.
Request
.Path = path;
35
context.
Request
.QueryString = new QueryString(queryString);
36
context.
Request
.Method = "GET";
Microsoft.AspNetCore.StaticFiles.Tests (10)
RangeHelperTests.cs (6)
65
httpContext.
Request
.Headers.Range = range;
68
var (isRangeRequest, parsedRangeResult) = RangeHelper.ParseRange(httpContext, httpContext.
Request
.GetTypedHeaders(), 10, NullLogger.Instance);
82
httpContext.
Request
.Headers.Range = range;
85
var (isRangeRequest, parsedRangeResult) = RangeHelper.ParseRange(httpContext, httpContext.
Request
.GetTypedHeaders(), 10, NullLogger.Instance);
98
httpContext.
Request
.Headers.Range = range.ToString();
101
var (isRangeRequest, parsedRange) = RangeHelper.ParseRange(httpContext, httpContext.
Request
.GetTypedHeaders(), 4, NullLogger.Instance);
StaticFileContextTest.cs (4)
47
httpContext.
Request
.Path = new PathString("/test/foo.txt");
75
httpContext.
Request
.Path = new PathString("/test/foo.txt");
104
httpContext.
Request
.Path = new PathString("/test/bar.txt");
129
httpContext.
Request
.Path = new PathString("/test/foo.txt");