From df08265edfe5b5af1a01d65a4032243a711f6c5d Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Mon, 7 Dec 2020 09:30:01 +0100 Subject: [PATCH] Added HttpRequest.HttpMethod, Deprecated HttpRequest.Method --- ln.http/HttpMethod.cs | 8 ++++++++ ln.http/HttpRequest.cs | 6 ++++-- ln.http/ln.http.csproj | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 ln.http/HttpMethod.cs diff --git a/ln.http/HttpMethod.cs b/ln.http/HttpMethod.cs new file mode 100644 index 0000000..7dce68d --- /dev/null +++ b/ln.http/HttpMethod.cs @@ -0,0 +1,8 @@ + + +namespace ln.http +{ + public enum HttpMethod { + HEAD, GET, POST, PUT, PATCH, DELETE, CONNECT, OPTIONS, TRACE + } +} \ No newline at end of file diff --git a/ln.http/HttpRequest.cs b/ln.http/HttpRequest.cs index cd69139..3a8cb08 100644 --- a/ln.http/HttpRequest.cs +++ b/ln.http/HttpRequest.cs @@ -30,7 +30,9 @@ namespace ln.http public Uri BaseURI { get; set; } public Uri URI { get; private set; } - public String Method { get; private set; } + [Obsolete] + public String Method { get => HttpMethod.ToString(); private set => throw new NotImplementedException(); } + public HttpMethod HttpMethod { get; private set; } public String RequestURL { get; private set; } public String Protocol { get; private set; } @@ -105,7 +107,7 @@ namespace ln.http if (requestTokens.Length != 3) throw new BadRequestException(); - Method = requestTokens[0]; + HttpMethod = (HttpMethod)Enum.Parse(typeof(HttpMethod), requestTokens[0]); RequestURL = requestTokens[1]; Protocol = requestTokens[2]; } diff --git a/ln.http/ln.http.csproj b/ln.http/ln.http.csproj index eec1b82..78d7d85 100644 --- a/ln.http/ln.http.csproj +++ b/ln.http/ln.http.csproj @@ -3,7 +3,7 @@ netcoreapp3.1 true - 0.2.3 + 0.2.4-test Harald Wolff-Thobaben l--n.de