Fix HTTP method choice for index requests #3221
Merged
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.
This commit fixes the selection of HTTP method for an index request based
on the presence of an explicilty set Id, or an Id value that can be inferred from
the document.
In the previous implementation, the IUrlParameter.GetString() method on the Id type
evaluated the Document to infer an Id from it, setting the internal Value of the Id to this
inferred value. As part of refactoring, this assignment was removed, which changes the
behaviour of the client when determining the HTTP method for an index request; in this
scenario, it is not enough to look to see if the Id type has a value, or that the Document is
not null, we need to know at this point that an Id can be inferred from the Document, and can
thereby send a PUT request.
An Id is inferred from the Document before the HTTP method is determined as part of resolving
RouteValues, so this commit changes the implementation to check if Id has a value, or
RouteValues.Id has a value.