From b86ab1636436998560a848307df1dbf6a4722363 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 19 Apr 2019 16:10:10 +0100 Subject: [PATCH] Use .IndexOf(char/byte) where possible --- src/Http/Routing/src/Matching/HostMatcherPolicy.cs | 2 +- src/Security/Authentication/JwtBearer/src/JwtBearerHandler.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Http/Routing/src/Matching/HostMatcherPolicy.cs b/src/Http/Routing/src/Matching/HostMatcherPolicy.cs index cb182af22a81..f99afdcfbd3e 100644 --- a/src/Http/Routing/src/Matching/HostMatcherPolicy.cs +++ b/src/Http/Routing/src/Matching/HostMatcherPolicy.cs @@ -109,7 +109,7 @@ public Task ApplyAsync(HttpContext httpContext, EndpointSelectorContext context, var port = ReadOnlySpan.Empty; // Split into host and port - var pivot = host.IndexOf(":"); + var pivot = host.IndexOf(':'); if (pivot >= 0) { port = host.Slice(pivot + 1); diff --git a/src/Security/Authentication/JwtBearer/src/JwtBearerHandler.cs b/src/Security/Authentication/JwtBearer/src/JwtBearerHandler.cs index 8fcc6eb50cbc..84ff83a765ea 100644 --- a/src/Security/Authentication/JwtBearer/src/JwtBearerHandler.cs +++ b/src/Security/Authentication/JwtBearer/src/JwtBearerHandler.cs @@ -226,7 +226,7 @@ protected override async Task HandleChallengeAsync(AuthenticationProperties prop // https://tools.ietf.org/html/rfc6750#section-3.1 // WWW-Authenticate: Bearer realm="example", error="invalid_token", error_description="The access token expired" var builder = new StringBuilder(Options.Challenge); - if (Options.Challenge.IndexOf(" ", StringComparison.Ordinal) > 0) + if (Options.Challenge.IndexOf(' ') > 0) { // Only add a comma after the first param, if any builder.Append(',');