diff --git a/src/Http/Http.Abstractions/src/HttpMethods.cs b/src/Http/Http.Abstractions/src/HttpMethods.cs
index 05a5f2e834..350b98faf2 100644
--- a/src/Http/Http.Abstractions/src/HttpMethods.cs
+++ b/src/Http/Http.Abstractions/src/HttpMethods.cs
@@ -5,12 +5,15 @@ using System;
namespace Microsoft.AspNetCore.Http
{
+ ///
+ /// Contains methods to verify the request method of an HTTP request.
+ ///
public static class HttpMethods
{
// We are intentionally using 'static readonly' here instead of 'const'.
- // 'const' values would be embedded in to each assembly that used them
+ // 'const' values would be embedded into each assembly that used them
// and each consuming assembly would have a different 'string' instance.
- // Using .'static readonly' means that all consumers get thee exact same
+ // Using .'static readonly' means that all consumers get these exact same
// 'string' instance, which means the 'ReferenceEquals' checks below work
// and allow us to optimize comparisons when these constants are used.
@@ -25,46 +28,109 @@ namespace Microsoft.AspNetCore.Http
public static readonly string Put = "PUT";
public static readonly string Trace = "TRACE";
+ ///
+ /// Returns a value that indicates if the HTTP request method is CONNECT.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is CONNECT; otherwise, .
+ ///
public static bool IsConnect(string method)
{
return object.ReferenceEquals(Connect, method) || StringComparer.OrdinalIgnoreCase.Equals(Connect, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is DELETE.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is DELETE; otherwise, .
+ ///
public static bool IsDelete(string method)
{
return object.ReferenceEquals(Delete, method) || StringComparer.OrdinalIgnoreCase.Equals(Delete, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is GET.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is GET; otherwise, .
+ ///
public static bool IsGet(string method)
{
return object.ReferenceEquals(Get, method) || StringComparer.OrdinalIgnoreCase.Equals(Get, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is HEAD.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is HEAD; otherwise, .
+ ///
public static bool IsHead(string method)
{
return object.ReferenceEquals(Head, method) || StringComparer.OrdinalIgnoreCase.Equals(Head, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is OPTIONS.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is OPTIONS; otherwise, .
+ ///
public static bool IsOptions(string method)
{
return object.ReferenceEquals(Options, method) || StringComparer.OrdinalIgnoreCase.Equals(Options, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is PATCH.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is PATCH; otherwise, .
+ ///
public static bool IsPatch(string method)
{
return object.ReferenceEquals(Patch, method) || StringComparer.OrdinalIgnoreCase.Equals(Patch, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is POST.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is POST; otherwise, .
+ ///
public static bool IsPost(string method)
{
return object.ReferenceEquals(Post, method) || StringComparer.OrdinalIgnoreCase.Equals(Post, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is PUT.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is PUT; otherwise, .
+ ///
public static bool IsPut(string method)
{
return object.ReferenceEquals(Put, method) || StringComparer.OrdinalIgnoreCase.Equals(Put, method);
}
+ ///
+ /// Returns a value that indicates if the HTTP request method is TRACE.
+ ///
+ /// The HTTP request method.
+ ///
+ /// if the method is TRACE; otherwise, .
+ ///
public static bool IsTrace(string method)
{
return object.ReferenceEquals(Trace, method) || StringComparer.OrdinalIgnoreCase.Equals(Trace, method);
diff --git a/src/Http/Http/src/DefaultHttpContext.cs b/src/Http/Http/src/DefaultHttpContext.cs
index 7d096f186a..59c7739e86 100644
--- a/src/Http/Http/src/DefaultHttpContext.cs
+++ b/src/Http/Http/src/DefaultHttpContext.cs
@@ -13,6 +13,9 @@ using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Http
{
+ ///
+ /// Represents an implementation of the HTTP Context class.
+ ///
public sealed class DefaultHttpContext : HttpContext
{
// Lambdas hoisted to static readonly fields to improve inlining https://github.com/dotnet/roslyn/issues/13624
@@ -32,6 +35,9 @@ namespace Microsoft.AspNetCore.Http
private DefaultConnectionInfo _connection;
private DefaultWebSocketManager _websockets;
+ ///
+ /// Initializes a new instance of the class.
+ ///
public DefaultHttpContext()
: this(new FeatureCollection())
{
@@ -40,6 +46,10 @@ namespace Microsoft.AspNetCore.Http
Features.Set(new StreamResponseBodyFeature(Stream.Null));
}
+ ///
+ /// Initializes a new instance of the class with provided features.
+ ///
+ /// Initial set of features for the .
public DefaultHttpContext(IFeatureCollection features)
{
_features.Initalize(features);
@@ -47,6 +57,13 @@ namespace Microsoft.AspNetCore.Http
_response = new DefaultHttpResponse(this);
}
+ ///
+ /// Reinitialize the current instant of the class with features passed in.
+ ///
+ ///
+ /// This method allows the consumer to re-use the for another request, rather than having to allocate a new instance.
+ ///
+ /// The new set of features for the .
public void Initialize(IFeatureCollection features)
{
var revision = features.Revision;
@@ -57,6 +74,9 @@ namespace Microsoft.AspNetCore.Http
_websockets?.Initialize(features, revision);
}
+ ///
+ /// Uninitialize all the features in the .
+ ///
public void Uninitialize()
{
_features = default;
@@ -66,8 +86,20 @@ namespace Microsoft.AspNetCore.Http
_websockets?.Uninitialize();
}
+ ///
+ /// Gets or set the for this instance.
+ ///
+ ///
+ ///
+ ///
public FormOptions FormOptions { get; set; }
+ ///
+ /// Gets or sets the for this instance.
+ ///
+ ///
+ ///
+ ///
public IServiceScopeFactory ServiceScopeFactory { get; set; }
private IItemsFeature ItemsFeature =>
@@ -92,16 +124,22 @@ namespace Microsoft.AspNetCore.Http
private IHttpRequestIdentifierFeature RequestIdentifierFeature =>
_features.Fetch(ref _features.Cache.RequestIdentifier, _newHttpRequestIdentifierFeature);
+ ///
public override IFeatureCollection Features => _features.Collection ?? ContextDisposed();
+ ///
public override HttpRequest Request => _request;
+ ///
public override HttpResponse Response => _response;
+ ///
public override ConnectionInfo Connection => _connection ?? (_connection = new DefaultConnectionInfo(Features));
+ ///
public override WebSocketManager WebSockets => _websockets ?? (_websockets = new DefaultWebSocketManager(Features));
+ ///
public override ClaimsPrincipal User
{
get
@@ -117,30 +155,35 @@ namespace Microsoft.AspNetCore.Http
set { HttpAuthenticationFeature.User = value; }
}
+ ///
public override IDictionary