-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFileHttpRequest.cs
More file actions
41 lines (38 loc) · 1.69 KB
/
Copy pathFileHttpRequest.cs
File metadata and controls
41 lines (38 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using System.Threading;
namespace AwesomeServerSample
{
public class FileHttpRequest : HttpRequest
{
public FileHttpRequest(HttpContext httpContext, string path)
{
var lines = File.ReadAllText(path).Split('\n');
var request = lines[0].Split(' ');
Method = request[0];
Path = request[1];
this.HttpContext = httpContext;
}
public override HttpContext HttpContext { get; }
public override string Method { get; set; }
public override string Scheme { get; set; } = "file";
public override bool IsHttps { get; set; }
public override HostString Host { get; set; }
public override PathString PathBase { get; set; }
public override PathString Path { get; set; }
public override QueryString QueryString { get; set; }
public override IQueryCollection Query { get; set; }
public override string Protocol { get; set; }
public override Stream Body { get; set; }
public override IHeaderDictionary Headers => new HeaderDictionary();
public override IRequestCookieCollection Cookies { get; set; }
public override long? ContentLength { get; set; }
public override string ContentType { get; set; }
public override IFormCollection Form { get; set; }
public override bool HasFormContentType => throw new NotImplementedException();
public override Task<IFormCollection> ReadFormAsync(CancellationToken cancellationToken = default(CancellationToken))
=> throw new NotImplementedException();
}
}