Skip to content

Commit a768f1b

Browse files
authored
Add HttpMethods.Query constant and IsQuery method to ASP.NET Core (#63260)
1 parent d757bfd commit a768f1b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/Http/Http.Abstractions/src/HttpMethods.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public static class HttpMethods
4949
/// </summary>
5050
public static readonly string Put = "PUT";
5151
/// <summary>
52+
/// HTTP "QUERY" method.
53+
/// </summary>
54+
public static readonly string Query = "QUERY";
55+
/// <summary>
5256
/// HTTP "TRACE" method.
5357
/// </summary>
5458
public static readonly string Trace = "TRACE";
@@ -149,6 +153,18 @@ public static bool IsPut(string method)
149153
return Equals(Put, method);
150154
}
151155

156+
/// <summary>
157+
/// Returns a value that indicates if the HTTP request method is QUERY.
158+
/// </summary>
159+
/// <param name="method">The HTTP request method.</param>
160+
/// <returns>
161+
/// <see langword="true" /> if the method is QUERY; otherwise, <see langword="false" />.
162+
/// </returns>
163+
public static bool IsQuery(string method)
164+
{
165+
return Equals(Query, method);
166+
}
167+
152168
/// <summary>
153169
/// Returns a value that indicates if the HTTP request method is TRACE.
154170
/// </summary>
@@ -175,6 +191,7 @@ string _ when IsDelete(method) => Delete,
175191
string _ when IsOptions(method) => Options,
176192
string _ when IsHead(method) => Head,
177193
string _ when IsPatch(method) => Patch,
194+
string _ when IsQuery(method) => Query,
178195
string _ when IsTrace(method) => Trace,
179196
string _ when IsConnect(method) => Connect,
180197
string _ => method

src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ Microsoft.AspNetCore.Http.Metadata.IDisableValidationMetadata
44
Microsoft.AspNetCore.Http.ProducesResponseTypeMetadata.Description.get -> string?
55
Microsoft.AspNetCore.Http.ProducesResponseTypeMetadata.Description.set -> void
66
Microsoft.AspNetCore.Http.Metadata.IProducesResponseTypeMetadata.Description.get -> string?
7+
static Microsoft.AspNetCore.Http.HttpMethods.IsQuery(string! method) -> bool
8+
static readonly Microsoft.AspNetCore.Http.HttpMethods.Query -> string!

src/Http/Http.Abstractions/test/HttpMethodslTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public void CanonicalizedValue_Success()
2020
(new string[] { "CONNECT", "Connect", "connect" }, HttpMethods.Connect),
2121
(new string[] { "OPTIONS", "Options", "options" }, HttpMethods.Options),
2222
(new string[] { "PATCH", "Patch", "patch" }, HttpMethods.Patch),
23+
(new string[] { "QUERY", "Query", "query" }, HttpMethods.Query),
2324
(new string[] { "TRACE", "Trace", "trace" }, HttpMethods.Trace)
2425
};
2526

0 commit comments

Comments
 (0)