fix some spelling (#1035)
This commit is contained in:
parent
b43bc0cb8a
commit
cfb0d732b0
|
|
@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Authentication
|
|||
/// Returns all of the AuthenticationTokens contained in the properties.
|
||||
/// </summary>
|
||||
/// <param name="properties">The <see cref="AuthenticationProperties"/> properties.</param>
|
||||
/// <returns>The authentication toekns.</returns>
|
||||
/// <returns>The authentication tokens.</returns>
|
||||
public static IEnumerable<AuthenticationToken> GetTokens(this AuthenticationProperties properties)
|
||||
{
|
||||
if (properties == null)
|
||||
|
|
@ -132,7 +132,7 @@ namespace Microsoft.AspNetCore.Authentication
|
|||
/// <param name="context">The <see cref="HttpContext"/> context.</param>
|
||||
/// <param name="tokenName">The name of the token.</param>
|
||||
/// <returns>The value of the token.</returns>
|
||||
public static Task<string> GetTokenAsync(this IAuthenticationService auth, HttpContext context, string tokenName)
|
||||
public static Task<string> GetTokenAsync(this IAuthenticationService auth, HttpContext context, string tokenName)
|
||||
=> auth.GetTokenAsync(context, scheme: null, tokenName: tokenName);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Authentication
|
|||
/// <summary>
|
||||
/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.
|
||||
/// This is typically specified via <see cref="AuthenticationOptions.DefaultSignOutScheme"/>.
|
||||
/// Otherwise this will fallback to <see cref="GetDefaultSignInSchemeAsync"/> if that supoorts sign out.
|
||||
/// Otherwise this will fallback to <see cref="GetDefaultSignInSchemeAsync"/> if that supports sign out.
|
||||
/// </summary>
|
||||
/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
|
||||
public virtual Task<AuthenticationScheme> GetDefaultSignOutSchemeAsync()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http;
|
|||
namespace Microsoft.AspNetCore.Builder.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Respresents a middleware that maps a request path to a sub-request pipeline.
|
||||
/// Represents a middleware that maps a request path to a sub-request pipeline.
|
||||
/// </summary>
|
||||
public class MapMiddleware
|
||||
{
|
||||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
|
|||
private readonly MapOptions _options;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instace of <see cref="MapMiddleware"/>.
|
||||
/// Creates a new instance of <see cref="MapMiddleware"/>.
|
||||
/// </summary>
|
||||
/// <param name="next">The delegate representing the next middleware in the request pipeline.</param>
|
||||
/// <param name="options">The middleware options.</param>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http;
|
|||
namespace Microsoft.AspNetCore.Builder.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Respresents a middleware that runs a sub-request pipeline when a given predicate is matched.
|
||||
/// Represents a middleware that runs a sub-request pipeline when a given predicate is matched.
|
||||
/// </summary>
|
||||
public class MapWhenMiddleware
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,13 +74,13 @@ namespace Microsoft.AspNetCore.Builder
|
|||
throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNoInvokeMethod(InvokeMethodName, InvokeAsyncMethodName, middleware));
|
||||
}
|
||||
|
||||
var methodinfo = invokeMethods[0];
|
||||
if (!typeof(Task).IsAssignableFrom(methodinfo.ReturnType))
|
||||
var methodInfo = invokeMethods[0];
|
||||
if (!typeof(Task).IsAssignableFrom(methodInfo.ReturnType))
|
||||
{
|
||||
throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNonTaskReturnType(InvokeMethodName, InvokeAsyncMethodName, nameof(Task)));
|
||||
}
|
||||
|
||||
var parameters = methodinfo.GetParameters();
|
||||
var parameters = methodInfo.GetParameters();
|
||||
if (parameters.Length == 0 || parameters[0].ParameterType != typeof(HttpContext))
|
||||
{
|
||||
throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNoParameters(InvokeMethodName, InvokeAsyncMethodName, nameof(HttpContext)));
|
||||
|
|
@ -92,10 +92,10 @@ namespace Microsoft.AspNetCore.Builder
|
|||
var instance = ActivatorUtilities.CreateInstance(app.ApplicationServices, middleware, ctorArgs);
|
||||
if (parameters.Length == 1)
|
||||
{
|
||||
return (RequestDelegate)methodinfo.CreateDelegate(typeof(RequestDelegate), instance);
|
||||
return (RequestDelegate)methodInfo.CreateDelegate(typeof(RequestDelegate), instance);
|
||||
}
|
||||
|
||||
var factory = Compile<object>(methodinfo, parameters);
|
||||
var factory = Compile<object>(methodInfo, parameters);
|
||||
|
||||
return context =>
|
||||
{
|
||||
|
|
@ -142,13 +142,13 @@ namespace Microsoft.AspNetCore.Builder
|
|||
});
|
||||
}
|
||||
|
||||
private static Func<T, HttpContext, IServiceProvider, Task> Compile<T>(MethodInfo methodinfo, ParameterInfo[] parameters)
|
||||
private static Func<T, HttpContext, IServiceProvider, Task> Compile<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
|
||||
{
|
||||
// If we call something like
|
||||
//
|
||||
// public class Middleware
|
||||
// {
|
||||
// public Task Invoke(HttpContext context, ILoggerFactory loggeryFactory)
|
||||
// public Task Invoke(HttpContext context, ILoggerFactory loggerFactory)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
|
@ -158,14 +158,14 @@ namespace Microsoft.AspNetCore.Builder
|
|||
// We'll end up with something like this:
|
||||
// Generic version:
|
||||
//
|
||||
// Task Invoke(Middleware instance, HttpContext httpContext, IServiceprovider provider)
|
||||
// Task Invoke(Middleware instance, HttpContext httpContext, IServiceProvider provider)
|
||||
// {
|
||||
// return instance.Invoke(httpContext, (ILoggerFactory)UseMiddlewareExtensions.GetService(provider, typeof(ILoggerFactory));
|
||||
// }
|
||||
|
||||
// Non generic version:
|
||||
//
|
||||
// Task Invoke(object instance, HttpContext httpContext, IServiceprovider provider)
|
||||
// Task Invoke(object instance, HttpContext httpContext, IServiceProvider provider)
|
||||
// {
|
||||
// return ((Middleware)instance).Invoke(httpContext, (ILoggerFactory)UseMiddlewareExtensions.GetService(provider, typeof(ILoggerFactory));
|
||||
// }
|
||||
|
|
@ -190,7 +190,7 @@ namespace Microsoft.AspNetCore.Builder
|
|||
{
|
||||
providerArg,
|
||||
Expression.Constant(parameterType, typeof(Type)),
|
||||
Expression.Constant(methodinfo.DeclaringType, typeof(Type))
|
||||
Expression.Constant(methodInfo.DeclaringType, typeof(Type))
|
||||
};
|
||||
|
||||
var getServiceCall = Expression.Call(GetServiceInfo, parameterTypeExpression);
|
||||
|
|
@ -198,12 +198,12 @@ namespace Microsoft.AspNetCore.Builder
|
|||
}
|
||||
|
||||
Expression middlewareInstanceArg = instanceArg;
|
||||
if (methodinfo.DeclaringType != typeof(T))
|
||||
if (methodInfo.DeclaringType != typeof(T))
|
||||
{
|
||||
middlewareInstanceArg = Expression.Convert(middlewareInstanceArg, methodinfo.DeclaringType);
|
||||
middlewareInstanceArg = Expression.Convert(middlewareInstanceArg, methodInfo.DeclaringType);
|
||||
}
|
||||
|
||||
var body = Expression.Call(middlewareInstanceArg, methodinfo, methodArguments);
|
||||
var body = Expression.Call(middlewareInstanceArg, methodInfo, methodArguments);
|
||||
|
||||
var lambda = Expression.Lambda<Func<T, HttpContext, IServiceProvider, Task>>(body, instanceArg, httpContextArg, providerArg);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
|
|||
private readonly PathString _pathBase;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instace of <see cref="UsePathBaseMiddleware"/>.
|
||||
/// Creates a new instance of <see cref="UsePathBaseMiddleware"/>.
|
||||
/// </summary>
|
||||
/// <param name="next">The delegate representing the next middleware in the request pipeline.</param>
|
||||
/// <param name="pathBase">The path base to extract.</param>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
private readonly string _value;
|
||||
|
||||
/// <summary>
|
||||
/// Initalize the path string with a given value. This value must be in unescaped format. Use
|
||||
/// Initialize the path string with a given value. This value must be in unescaped format. Use
|
||||
/// PathString.FromUriComponent(value) if you have a path value which is in an escaped format.
|
||||
/// </summary>
|
||||
/// <param name="value">The unescaped path to be assigned to the Value property.</param>
|
||||
|
|
@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
{
|
||||
if (!requiresEscaping)
|
||||
{
|
||||
// the current segument doesn't require escape
|
||||
// the current segment doesn't require escape
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = new StringBuilder(_value.Length * 3);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Http.Features
|
|||
}
|
||||
else if (flush)
|
||||
{
|
||||
// Cache was cleared, but item retrived from current Collection for version
|
||||
// Cache was cleared, but item retrieved from current Collection for version
|
||||
// so use passed in revision rather than making another virtual call
|
||||
Revision = revision;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Http.Features
|
|||
//
|
||||
// value
|
||||
|
||||
// Do not limit the key name length here because the mulipart headers length limit is already in effect.
|
||||
// Do not limit the key name length here because the multipart headers length limit is already in effect.
|
||||
var key = formDataSection.Name;
|
||||
var value = await formDataSection.GetValueAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
// Null out the TraceIdentifier here as a sign that this request is done,
|
||||
// the HttpContextAcessor implementation relies on this to detect that the request is over
|
||||
// the HttpContextAccessor implementation relies on this to detect that the request is over
|
||||
httpContext.TraceIdentifier = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ namespace Microsoft.AspNetCore.Builder
|
|||
{
|
||||
Func<RequestDelegate, RequestDelegate> middleware1 = next1 =>
|
||||
{
|
||||
AppFunc exitMiddlware = env =>
|
||||
AppFunc exitMiddleware = env =>
|
||||
{
|
||||
return next1((HttpContext)env[typeof(HttpContext).FullName]);
|
||||
};
|
||||
var app = middleware(exitMiddlware);
|
||||
var app = middleware(exitMiddleware);
|
||||
return httpContext =>
|
||||
{
|
||||
// Use the existing OWIN env if there is one.
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ namespace Microsoft.AspNetCore.Owin
|
|||
// 2. The middleware inserts an alternate Accept signature into the OWIN environment.
|
||||
// 3. The middleware invokes Next and stores Next's Task locally. It then returns an alternate Task to the server.
|
||||
// 4. The OwinFeatureCollection adapts the alternate Accept signature to IHttpWebSocketFeature.AcceptAsync.
|
||||
// 5. A component later in the pipleline invokes IHttpWebSocketFeature.AcceptAsync (mapped to AcceptWebSocketAsync).
|
||||
// 5. A component later in the pipeline invokes IHttpWebSocketFeature.AcceptAsync (mapped to AcceptWebSocketAsync).
|
||||
// 6. The middleware calls the OWIN Accept, providing a local callback, and returns an incomplete Task.
|
||||
// 7. The middleware completes the alternate Task it returned from Invoke, telling the server that the request pipeline has completed.
|
||||
// 8. The server invokes the middleware's callback, which creats a WebSocket adapter complete's the orriginal Accept Task with it.
|
||||
// 8. The server invokes the middleware's callback, which creates a WebSocket adapter and completes the original Accept Task with it.
|
||||
// 9. The middleware waits while the application uses the WebSocket, where the end is signaled by the Next's Task completion.
|
||||
public static AppFunc AdaptWebSockets(AppFunc next)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
public KeyValuePair<string, string>? ReadNextPair()
|
||||
{
|
||||
ReadNextPairImpl();
|
||||
if (ReadSucceded())
|
||||
if (ReadSucceeded())
|
||||
{
|
||||
return new KeyValuePair<string, string>(_currentKey, _currentValue);
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
public async Task<KeyValuePair<string, string>?> ReadNextPairAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
await ReadNextPairAsyncImpl(cancellationToken);
|
||||
if (ReadSucceded())
|
||||
if (ReadSucceeded())
|
||||
{
|
||||
return new KeyValuePair<string, string>(_currentKey, _currentValue);
|
||||
}
|
||||
|
|
@ -189,11 +189,11 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool TryReadWord(char seperator, int limit, out string value)
|
||||
private bool TryReadWord(char separator, int limit, out string value)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (ReadChar(seperator, limit, out value))
|
||||
if (ReadChar(separator, limit, out value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool ReadChar(char seperator, int limit, out string word)
|
||||
private bool ReadChar(char separator, int limit, out string word)
|
||||
{
|
||||
// End
|
||||
if (_bufferCount == 0)
|
||||
|
|
@ -213,7 +213,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
var c = _buffer[_bufferOffset++];
|
||||
_bufferCount--;
|
||||
|
||||
if (c == seperator)
|
||||
if (c == separator)
|
||||
{
|
||||
word = BuildWord();
|
||||
return true;
|
||||
|
|
@ -283,14 +283,14 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
return accumulator.GetResults();
|
||||
}
|
||||
|
||||
private bool ReadSucceded()
|
||||
private bool ReadSucceeded()
|
||||
{
|
||||
return _currentKey != null && _currentValue != null;
|
||||
}
|
||||
|
||||
private void Append(ref KeyValueAccumulator accumulator)
|
||||
{
|
||||
if (ReadSucceded())
|
||||
if (ReadSucceeded())
|
||||
{
|
||||
accumulator.Append(_currentKey, _currentValue);
|
||||
if (accumulator.ValueCount > ValueCountLimit)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
var anchorIndex = uri.IndexOf('#');
|
||||
var uriToBeAppended = uri;
|
||||
var anchorText = "";
|
||||
// If there is an anchor, then the query string must be inserted before its first occurance.
|
||||
// If there is an anchor, then the query string must be inserted before its first occurence.
|
||||
if (anchorIndex != -1)
|
||||
{
|
||||
anchorText = uri.Substring(anchorIndex);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
{
|
||||
if (!StringSegment.IsNullOrEmpty(fileName))
|
||||
{
|
||||
FileName = Sanatize(fileName);
|
||||
FileName = Sanitize(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -166,7 +166,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
|
||||
/// <summary>
|
||||
/// Sets the FileName parameter using encodings appropriate for MIME headers.
|
||||
/// The FileNameStar paraemter is removed.
|
||||
/// The FileNameStar parameter is removed.
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
public void SetMimeFileName(StringSegment fileName)
|
||||
|
|
@ -434,7 +434,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
// Replaces characters not suitable for HTTP headers with '_' rather than MIME encoding them.
|
||||
private StringSegment Sanatize(StringSegment input)
|
||||
private StringSegment Sanitize(StringSegment input)
|
||||
{
|
||||
var result = input;
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
}
|
||||
|
||||
// Since we never re-use a "found" value in 'y', we expecte 'alreadyFound' to have all fields set to 'true'.
|
||||
// Since we never re-use a "found" value in 'y', we expected 'alreadyFound' to have all fields set to 'true'.
|
||||
// Otherwise the two collections can't be equal and we should not get here.
|
||||
Contract.Assert(Contract.ForAll(alreadyFound, value => { return value; }),
|
||||
"Expected all values in 'alreadyFound' to be true since collections are considered equal.");
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
return HttpParseResult.NotParsed;
|
||||
}
|
||||
|
||||
// Quoted-char has 2 characters. Check wheter there are 2 chars left ('\' + char)
|
||||
// Quoted-char has 2 characters. Check whether there are 2 chars left ('\' + char)
|
||||
// If so, check whether the character is in the range 0-127. If not, it's an invalid value.
|
||||
if ((startIndex + 2 > input.Length) || (input[startIndex + 1] > 127))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
current = current + fromLength;
|
||||
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
|
||||
|
||||
// Afer the first value, the '-' character must follow.
|
||||
// After the first value, the '-' character must follow.
|
||||
if ((current == input.Length) || (input[current] != '-'))
|
||||
{
|
||||
// We need a '-' character otherwise this can't be a valid range.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
|
|||
|
||||
public class MapPredicateMiddlewareTests
|
||||
{
|
||||
private static readonly Predicate NotImplementedPredicate = new Predicate(envionment => { throw new NotImplementedException(); });
|
||||
private static readonly Predicate NotImplementedPredicate = new Predicate(environment => { throw new NotImplementedException(); });
|
||||
|
||||
private static Task Success(HttpContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,10 +59,10 @@ namespace Microsoft.AspNetCore.Http.Abstractions
|
|||
[InlineData("", "value", "?=value")]
|
||||
[InlineData("", "", "?=")]
|
||||
[InlineData("", null, "?=")]
|
||||
public void CreateNameValue_Success(string name, string value, string exepcted)
|
||||
public void CreateNameValue_Success(string name, string value, string expected)
|
||||
{
|
||||
var query = QueryString.Create(name, value);
|
||||
Assert.Equal(exepcted, query.Value);
|
||||
Assert.Equal(expected, query.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void UseMiddleware_MutlipleInvokeMethods_ThrowsException()
|
||||
public void UseMiddleware_MultipleInvokeMethods_ThrowsException()
|
||||
{
|
||||
var builder = new ApplicationBuilder(new DummyServiceProvider());
|
||||
builder.UseMiddleware(typeof(MiddlewareMultipleInvokesStub));
|
||||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void UseMiddleware_MutlipleInvokeAsyncMethods_ThrowsException()
|
||||
public void UseMiddleware_MultipleInvokeAsyncMethods_ThrowsException()
|
||||
{
|
||||
var builder = new ApplicationBuilder(new DummyServiceProvider());
|
||||
builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAsyncStub));
|
||||
|
|
@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void UseMiddleware_MutlipleInvokeAndInvokeAsyncMethods_ThrowsException()
|
||||
public void UseMiddleware_MultipleInvokeAndInvokeAsyncMethods_ThrowsException()
|
||||
{
|
||||
var builder = new ApplicationBuilder(new DummyServiceProvider());
|
||||
builder.UseMiddleware(typeof(MiddlewareMultipleInvokeAndInvokeAsyncStub));
|
||||
|
|
@ -153,7 +153,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void UseMiddlewareWithIvokeWithOutAndRefThrows()
|
||||
public void UseMiddlewareWithInvokeWithOutAndRefThrows()
|
||||
{
|
||||
var mockServiceProvider = new DummyServiceProvider();
|
||||
var builder = new ApplicationBuilder(mockServiceProvider);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
features.Set<IHttpResponseFeature>(new HttpResponseFeature());
|
||||
features.Set<IHttpWebSocketFeature>(new TestHttpWebSocketFeature());
|
||||
|
||||
// featurecollection is set. all cached interfaces are null.
|
||||
// FeatureCollection is set. all cached interfaces are null.
|
||||
var context = new DefaultHttpContext(features);
|
||||
TestAllCachedFeaturesAreNull(context, features);
|
||||
Assert.Equal(3, features.Count());
|
||||
|
|
@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
TestAllCachedFeaturesAreSet(context, features);
|
||||
Assert.NotEqual(3, features.Count());
|
||||
|
||||
// featurecollection is null. and all cached interfaces are null.
|
||||
// FeatureCollection is null. and all cached interfaces are null.
|
||||
// only top level is tested because child objects are inaccessible.
|
||||
context.Uninitialize();
|
||||
TestCachedFeaturesAreNull(context, null);
|
||||
|
|
@ -177,7 +177,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
newFeatures.Set<IHttpResponseFeature>(new HttpResponseFeature());
|
||||
newFeatures.Set<IHttpWebSocketFeature>(new TestHttpWebSocketFeature());
|
||||
|
||||
// featurecollection is set to newFeatures. all cached interfaces are null.
|
||||
// FeatureCollection is set to newFeatures. all cached interfaces are null.
|
||||
context.Initialize(newFeatures);
|
||||
TestAllCachedFeaturesAreNull(context, newFeatures);
|
||||
Assert.Equal(3, newFeatures.Count());
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void EmtpyQuotedHeaderSegmentsAreIgnored()
|
||||
public void EmptyQuotedHeaderSegmentsAreIgnored()
|
||||
{
|
||||
var headers = new HeaderDictionary(
|
||||
new Dictionary<string, StringValues>(StringComparer.OrdinalIgnoreCase)
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ namespace Microsoft.AspNetCore.Http.Tests
|
|||
{
|
||||
var headers = new HeaderDictionary();
|
||||
var cookies = new ResponseCookies(headers, null);
|
||||
var testcookie = "TestCookie";
|
||||
var testCookie = "TestCookie";
|
||||
|
||||
cookies.Delete(testcookie);
|
||||
cookies.Delete(testCookie);
|
||||
|
||||
var cookieHeaderValues = headers[HeaderNames.SetCookie];
|
||||
Assert.Single(cookieHeaderValues);
|
||||
Assert.StartsWith(testcookie, cookieHeaderValues[0]);
|
||||
Assert.StartsWith(testCookie, cookieHeaderValues[0]);
|
||||
Assert.Contains("path=/", cookieHeaderValues[0]);
|
||||
Assert.Contains("expires=Thu, 01 Jan 1970 00:00:00 GMT", cookieHeaderValues[0]);
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Http.Tests
|
|||
{
|
||||
var headers = new HeaderDictionary();
|
||||
var cookies = new ResponseCookies(headers, null);
|
||||
var testcookie = "TestCookie";
|
||||
var testCookie = "TestCookie";
|
||||
var time = new DateTimeOffset(2000, 1, 1, 1, 1, 1, 1, TimeSpan.Zero);
|
||||
var options = new CookieOptions
|
||||
{
|
||||
|
|
@ -43,11 +43,11 @@ namespace Microsoft.AspNetCore.Http.Tests
|
|||
SameSite = SameSiteMode.Lax
|
||||
};
|
||||
|
||||
cookies.Delete(testcookie, options);
|
||||
cookies.Delete(testCookie, options);
|
||||
|
||||
var cookieHeaderValues = headers[HeaderNames.SetCookie];
|
||||
Assert.Single(cookieHeaderValues);
|
||||
Assert.StartsWith(testcookie, cookieHeaderValues[0]);
|
||||
Assert.StartsWith(testCookie, cookieHeaderValues[0]);
|
||||
Assert.Contains("path=/", cookieHeaderValues[0]);
|
||||
Assert.Contains("expires=Thu, 01 Jan 1970 00:00:00 GMT", cookieHeaderValues[0]);
|
||||
Assert.Contains("secure", cookieHeaderValues[0]);
|
||||
|
|
@ -60,14 +60,14 @@ namespace Microsoft.AspNetCore.Http.Tests
|
|||
{
|
||||
var headers = new HeaderDictionary();
|
||||
var cookies = new ResponseCookies(headers, null);
|
||||
var testcookie = "TestCookie";
|
||||
var testCookie = "TestCookie";
|
||||
|
||||
cookies.Append(testcookie, testcookie);
|
||||
cookies.Delete(testcookie);
|
||||
cookies.Append(testCookie, testCookie);
|
||||
cookies.Delete(testCookie);
|
||||
|
||||
var cookieHeaderValues = headers[HeaderNames.SetCookie];
|
||||
Assert.Single(cookieHeaderValues);
|
||||
Assert.StartsWith(testcookie, cookieHeaderValues[0]);
|
||||
Assert.StartsWith(testCookie, cookieHeaderValues[0]);
|
||||
Assert.Contains("path=/", cookieHeaderValues[0]);
|
||||
Assert.Contains("expires=Thu, 01 Jan 1970 00:00:00 GMT", cookieHeaderValues[0]);
|
||||
}
|
||||
|
|
@ -80,9 +80,9 @@ namespace Microsoft.AspNetCore.Http.Tests
|
|||
var cookieOptions = new CookieOptions();
|
||||
var maxAgeTime = TimeSpan.FromHours(1);
|
||||
cookieOptions.MaxAge = TimeSpan.FromHours(1);
|
||||
var testcookie = "TestCookie";
|
||||
var testCookie = "TestCookie";
|
||||
|
||||
cookies.Append(testcookie, testcookie, cookieOptions);
|
||||
cookies.Append(testCookie, testCookie, cookieOptions);
|
||||
|
||||
var cookieHeaderValues = headers[HeaderNames.SetCookie];
|
||||
Assert.Single(cookieHeaderValues);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Owin
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void OwinEnvironmentImpelmentsGetEnumerator()
|
||||
public void OwinEnvironmentImplementsGetEnumerator()
|
||||
{
|
||||
var owinEnvironment = new OwinEnvironment(CreateContext());
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadSinglePartBody_Success()
|
||||
public async Task MultipartReader_ReadSinglePartBody_Success()
|
||||
{
|
||||
var stream = MakeStream(OnePartBody);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_HeaderCountExceeded_Throws()
|
||||
public async Task MultipartReader_HeaderCountExceeded_Throws()
|
||||
{
|
||||
var stream = MakeStream(OnePartBodyTwoHeaders);
|
||||
var reader = new MultipartReader(Boundary, stream)
|
||||
|
|
@ -136,7 +136,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_HeadersLengthExceeded_Throws()
|
||||
public async Task MultipartReader_HeadersLengthExceeded_Throws()
|
||||
{
|
||||
var stream = MakeStream(OnePartBodyTwoHeaders);
|
||||
var reader = new MultipartReader(Boundary, stream)
|
||||
|
|
@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadSinglePartBodyWithTrailingWhitespace_Success()
|
||||
public async Task MultipartReader_ReadSinglePartBodyWithTrailingWhitespace_Success()
|
||||
{
|
||||
var stream = MakeStream(OnePartBodyWithTrailingWhitespace);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadSinglePartBodyWithoutLastCRLF_Success()
|
||||
public async Task MultipartReader_ReadSinglePartBodyWithoutLastCRLF_Success()
|
||||
{
|
||||
var stream = MakeStream(OnePartBodyWithoutFinalCRLF);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadTwoPartBody_Success()
|
||||
public async Task MultipartReader_ReadTwoPartBody_Success()
|
||||
{
|
||||
var stream = MakeStream(TwoPartBody);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadTwoPartBodyWithUnicodeFileName_Success()
|
||||
public async Task MultipartReader_ReadTwoPartBodyWithUnicodeFileName_Success()
|
||||
{
|
||||
var stream = MakeStream(TwoPartBodyWithUnicodeFileName);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -235,7 +235,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ThreePartBody_Success()
|
||||
public async Task MultipartReader_ThreePartBody_Success()
|
||||
{
|
||||
var stream = MakeStream(ThreePartBody);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -270,7 +270,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void MutipartReader_BufferSizeMustBeLargerThanBoundary_Throws()
|
||||
public void MultipartReader_BufferSizeMustBeLargerThanBoundary_Throws()
|
||||
{
|
||||
var stream = MakeStream(ThreePartBody);
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
|
|
@ -280,7 +280,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_TwoPartBodyIncompleteBuffer_TwoSectionsReadSuccessfullyThirdSectionThrows()
|
||||
public async Task MultipartReader_TwoPartBodyIncompleteBuffer_TwoSectionsReadSuccessfullyThirdSectionThrows()
|
||||
{
|
||||
var stream = MakeStream(TwoPartBodyIncompleteBuffer);
|
||||
var reader = new MultipartReader(Boundary, stream);
|
||||
|
|
@ -311,7 +311,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadInvalidUtf8Header_ReplacementCharacters()
|
||||
public async Task MultipartReader_ReadInvalidUtf8Header_ReplacementCharacters()
|
||||
{
|
||||
var body1 =
|
||||
"--9051914041544843365972754266\r\n" +
|
||||
|
|
@ -346,7 +346,7 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MutipartReader_ReadInvalidUtf8SurrogateHeader_ReplacementCharacters()
|
||||
public async Task MultipartReader_ReadInvalidUtf8SurrogateHeader_ReplacementCharacters()
|
||||
{
|
||||
var body1 =
|
||||
"--9051914041544843365972754266\r\n" +
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
{
|
||||
{ "inline", new ContentDispositionHeaderValue("inline") }, // @"This should be equivalent to not including the header at all."
|
||||
{ "inline;", new ContentDispositionHeaderValue("inline") },
|
||||
{ "inline;name=", new ContentDispositionHeaderValue("inline") { Parameters = { new NameValueHeaderValue("name", "") } } }, // TODO: passing in a null value causes a strange assert on CoreCLR before the test even starts. Not reproducable in the body of a test.
|
||||
{ "inline;name=", new ContentDispositionHeaderValue("inline") { Parameters = { new NameValueHeaderValue("name", "") } } }, // TODO: passing in a null value causes a strange assert on CoreCLR before the test even starts. Not reproducible in the body of a test.
|
||||
{ "inline;name=value", new ContentDispositionHeaderValue("inline") { Name = "value" } },
|
||||
{ "inline;name=value;", new ContentDispositionHeaderValue("inline") { Name = "value" } },
|
||||
{ "inline;name=value;", new ContentDispositionHeaderValue("inline") { Name = "value" } },
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
public void CookieHeaderValue_ParseList_ExcludesInvalidValues(IList<CookieHeaderValue> cookies, string[] input)
|
||||
{
|
||||
var results = CookieHeaderValue.ParseList(input);
|
||||
// ParseList aways returns a list, even if empty. TryParseList may return null (via out).
|
||||
// ParseList always returns a list, even if empty. TryParseList may return null (via out).
|
||||
Assert.Equal(cookies ?? new List<CookieHeaderValue>(), results);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseList_WithSomeInvlaidValues_ExcludesInvalidValues()
|
||||
public void ParseList_WithSomeInvalidValues_ExcludesInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -433,7 +433,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseStrictList_WithSomeInvlaidValues_Throws()
|
||||
public void ParseStrictList_WithSomeInvalidValues_Throws()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -451,7 +451,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseList_WithSomeInvlaidValues_ExcludesInvalidValues()
|
||||
public void TryParseList_WithSomeInvalidValues_ExcludesInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -482,7 +482,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseStrictList_WithSomeInvlaidValues_ReturnsFalse()
|
||||
public void TryParseStrictList_WithSomeInvalidValues_ReturnsFalse()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseList_WithSomeInvlaidValues_IgnoresInvalidValues()
|
||||
public void ParseList_WithSomeInvalidValues_IgnoresInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -640,7 +640,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseStrictList_WithSomeInvlaidValues_Throws()
|
||||
public void ParseStrictList_WithSomeInvalidValues_Throws()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -651,7 +651,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseList_WithSomeInvlaidValues_IgnoresInvalidValues()
|
||||
public void TryParseList_WithSomeInvalidValues_IgnoresInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -676,7 +676,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseStrictList_WithSomeInvlaidValues_ReturnsFalse()
|
||||
public void TryParseStrictList_WithSomeInvalidValues_ReturnsFalse()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Copy_NameOnly_SuccesfullyCopied()
|
||||
public void Copy_NameOnly_SuccessfullyCopied()
|
||||
{
|
||||
var pair0 = new NameValueHeaderValue("name");
|
||||
var pair1 = pair0.Copy();
|
||||
|
|
@ -95,7 +95,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Copy_NameAndValue_SuccesfullyCopied()
|
||||
public void Copy_NameAndValue_SuccessfullyCopied()
|
||||
{
|
||||
var pair0 = new NameValueHeaderValue("name", "value");
|
||||
var pair1 = pair0.Copy();
|
||||
|
|
@ -466,7 +466,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseList_WithSomeInvlaidValues_ExcludesInvalidValues()
|
||||
public void ParseList_WithSomeInvalidValues_ExcludesInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -502,7 +502,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseStrictList_WithSomeInvlaidValues_Throws()
|
||||
public void ParseStrictList_WithSomeInvalidValues_Throws()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -520,7 +520,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseList_WithSomeInvlaidValues_ExcludesInvalidValues()
|
||||
public void TryParseList_WithSomeInvalidValues_ExcludesInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -557,7 +557,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseStrictList_WithSomeInvlaidValues_ReturnsFalse()
|
||||
public void TryParseStrictList_WithSomeInvalidValues_ReturnsFalse()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ToString_UseDifferentrangeConditions_AllSerializedCorrectly()
|
||||
public void ToString_UseDifferentRangeConditions_AllSerializedCorrectly()
|
||||
{
|
||||
var rangeCondition = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"x\""));
|
||||
Assert.Equal("\"x\"", rangeCondition.ToString());
|
||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void GetHashCode_UseSameAndDifferentrangeConditions_SameOrDifferentHashCodes()
|
||||
public void GetHashCode_UseSameAndDifferentRangeConditions_SameOrDifferentHashCodes()
|
||||
{
|
||||
var rangeCondition1 = new RangeConditionHeaderValue("\"x\"");
|
||||
var rangeCondition2 = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"x\""));
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
public void SetCookieHeaderValue_ParseList_ExcludesInvalidValues(IList<SetCookieHeaderValue> cookies, string[] input)
|
||||
{
|
||||
var results = SetCookieHeaderValue.ParseList(input);
|
||||
// ParseList aways returns a list, even if empty. TryParseList may return null (via out).
|
||||
// ParseList always returns a list, even if empty. TryParseList may return null (via out).
|
||||
Assert.Equal(cookies ?? new List<SetCookieHeaderValue>(), results);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseList_WithSomeInvlaidValues_IgnoresInvalidValues()
|
||||
public void ParseList_WithSomeInvalidValues_IgnoresInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -392,7 +392,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseStrictList_WithSomeInvlaidValues_Throws()
|
||||
public void ParseStrictList_WithSomeInvalidValues_Throws()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -412,7 +412,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseList_WithSomeInvlaidValues_IgnoresInvalidValues()
|
||||
public void TryParseList_WithSomeInvalidValues_IgnoresInvalidValues()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
@ -451,7 +451,7 @@ namespace Microsoft.Net.Http.Headers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseStrictList_WithSomeInvlaidValues_ReturnsFalse()
|
||||
public void TryParseStrictList_WithSomeInvalidValues_ReturnsFalse()
|
||||
{
|
||||
var inputs = new[]
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue