Repository navigation
Add HttpClient.QueryAsync overloads (#113522) - #136866
Manish-1kumar wants to merge 2 commits into
Conversation
Implements the four approved QueryAsync overloads on HttpClient following the approved API proposal for RFC 10008 QUERY method support: - Task<HttpResponseMessage> QueryAsync(string?, HttpContent?) - Task<HttpResponseMessage> QueryAsync(string?, HttpContent?, CancellationToken) - Task<HttpResponseMessage> QueryAsync(Uri?, HttpContent?) - Task<HttpResponseMessage> QueryAsync(Uri?, HttpContent?, CancellationToken) Also updates the reference assembly and adds unit tests verifying method invocation, request headers/content preservation, cancellation, and ObjectDisposedException behavior. Fixes dotnet#113522
|
Azure Pipelines: Successfully started running 4 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
| public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { throw null; } | ||
| public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content) { throw null; } | ||
| public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { throw null; } | ||
| public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> QueryAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content) { throw null; } |
There was a problem hiding this comment.
Was this generated with https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/updating-ref-source.md ???
Can you confirm?
There was a problem hiding this comment.
Yes, confirmed! The QueryAsync declarations were generated following docs/coding-guidelines/updating-ref-source.md via dotnet msbuild /t:GenerateReferenceAssemblySource /p:TargetFramework=net12.0.
As recommended in the doc, unrelated GenAPI diff churn across pre-existing APIs (which causes CS8768/CS8769/CS8616 compiler errors on untouched types) was filtered out, keeping only the exact GenAPI-emitted declarations for the new QueryAsync overloads.
Both the reference assembly and implementation assembly build cleanly with 0 warnings/errors, and ApiCompat validation passes.
| return SendAsync(request, cancellationToken); | ||
| } | ||
|
|
||
| public Task<HttpResponseMessage> QueryAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content) => |
There was a problem hiding this comment.
All new APIs should have /// docs
There was a problem hiding this comment.
Thanks for the feedback! I've added XML documentation (///) to all four QueryAsync overloads, including summaries, parameter descriptions, return values, and applicable exceptions.
Verified the changes with a successful System.Net.Http build (0 warnings, 0 errors) and git diff --check.
No implementation or API signature changes were made.
Fixes #113522
Summary
This PR implements the approved API proposal for adding QueryAsync overloads to HttpClient to support the RFC 10008 HTTP QUERY method:
Changes
Validation