Skip to content

Commit

Permalink
Use HttpMethods.IsGet()
Browse files Browse the repository at this point in the history
Use `HttpMethods.IsGet()` instead of a string comparison.
  • Loading branch information
martincostello committed Jul 31, 2024
1 parent f2ed1aa commit 531c4c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Swashbuckle.AspNetCore.Swagger/SwaggerMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ private bool RequestingSwaggerDocument(HttpRequest request, out string documentN
{
documentName = null;
extension = null;
if (request.Method != "GET") return false;

if (!HttpMethods.IsGet(request.Method))
{
return false;
}

var routeValues = new RouteValueDictionary();
if (_requestMatcher.TryMatch(request.Path, routeValues))
Expand Down

0 comments on commit 531c4c0

Please sign in to comment.