Add QueryAsync support for the HTTP QUERY (RFC 10008) - #62
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QueryAsyncextension method family onHttpRequestBuilder, mirroringGetAsync/PostAsync/etc. with the same four overloads (no-args,CancellationToken,HttpCompletionOption, and both), for the HTTP QUERY method defined in RFC 10008. UsesHttpMethod.Queryon .NET 10+ and falls back to a customHttpMethodon earlier multi-targeted frameworks.FluentJsonSerializer.DefaultJsonSerializerOptionsgatingDefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNullbehind#if NETSTANDARD2_1_OR_GREATER, a symbol that is only defined for the literalnetstandard2.1TFM and not fornet6.0and later. This causednull-valued properties to be serialized as"property":nullinstead of omitted onnet6.0throughnet10.0, inconsistent with thenetstandard2.1build. Changed the gate to#if !NETSTANDARD2_0, which coversnetstandard2.1and everynet6.0+TFM, including future ones added to the multi-target list.QueryAsyncTests, covering all fourQueryAsyncoverloads and asserting the request method isHttpMethod.Query.QueryAsyncadditiondocs/docs/sending-requests.mdwith the a QUERY section and example, and added a row to the Quick Reference table.QueryAsyncnote todocs/docs/index.mdRelated issue
Fixes #61 (null properties serialized instead of omitted on net6.0+, reported against 5.0.3)
Type
Checklist
Notes
SendAsync(string)/SendAsync(HttpMethod)overloads. This PR doesn't add the ability to send QUERY requests; it adds a first-class, named convenience method for it, matching the DX of the other verbs.QueryAsyncaddition is not a breaking change.HttpMethod.Queryonly exists on .NET 10+, so the string-based"QUERY"fallback is required fornetstandard2.0,netstandard2.1, andnet6.0throughnet9.0.net6.0throughnet10.0builds: consumers relying on the (buggy) inclusion ofnullproperties will see a behavior change, though this brings those TFMs in line with the already-correctnetstandard2.1behavior.