fix: avoid mutating resource paths in ODataRequestCount#1121
fix: avoid mutating resource paths in ODataRequestCount#1121Louis-Stegra wants to merge 2 commits intoSAP:mainfrom
Conversation
There was a problem hiding this comment.
I would prefer if we fixed it for other request builder(s) too.
From first look it appears we can change the behavior of ODataResourcePath to be immutable by introducing wither-like behavior on the addXyz(..) methods. I.e. not returning this but a new instance.
If we changed it that way, we'll need a sentence in our release notes too 👍
|
Sounds like a reasonable option. I started with targeted fix, as I don't really know the codebase. If you believe it's better to make |
|
Updated PR: ContextThis change makes Feature scope:
Definition of Done
|
Context
Bug report: #1120
Feature scope:
CountRequestBuilder.toRequest()for OData V4 had the side effect of mutating the sharedODataResourcePathwhen appending$countto it. Reusing the same builder could therefore produce invalid paths such as$count/$count. This change makesODataRequestCountcopy the incoming resource path before appending extra segments, so repeatedtoRequest()calls remain stable and do not corrupt later execution.That fix was inspired by a similar implementation in
ODataRequestFunctionFeature scopes:
Definition of Done
Error handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated