You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the name "Get" implies, this method should not modify the request itself, or at least in an way which is idempodent.
Currently, the call adds the base URL and the query parameters to the Resource property, modifying it in the process. Calling it again, repeats the steps which leads to the base url added again as prefix and the query parameters as postfix.
While one could argue that a request is only meant to be used once and then thrown away, there are some reasons to call this information more than once:
Logging of the Url will require it to be built before sending it. By calling this Get-method, actually sending the request will call it again and the request is unusable because of duplicate prefixes.
Re-Authentication of failed requests: When e.g. Bearer Tokens expire it is a behaviour put between the actual API implementation and the REST Client which takes care about delegating the Authentication Challenge to an Identity Service, refreshing the Token, modify the Authentication Header and repeat the request transparent to the nature of the requests semantics. It would be convenient to modify the request and re-use it. This is currently not quite possible as for once, the request cannot be re-used as stated above and the original data (given by the Resource property) is modified so that base url of the RestClient and the QueryParameters are put in it so that the original Resource cannot be retrieved easily and put in a new request.
As solution and much better design attempt, please consider not modifying the public visible state during sending the request. Two possible attempts:
Consider the request immutable after sending: Still the original data should be retrievable to build a second "equal" request from the first one
Sending the request does not modify state of the request at all and allow reusing it.
In my opinion the second option would be the better as it provides more flexibility and has a more straight forward design without implicit states of the object.
The text was updated successfully, but these errors were encountered:
As the name "Get" implies, this method should not modify the request itself, or at least in an way which is idempodent.
Currently, the call adds the base URL and the query parameters to the Resource property, modifying it in the process. Calling it again, repeats the steps which leads to the base url added again as prefix and the query parameters as postfix.
While one could argue that a request is only meant to be used once and then thrown away, there are some reasons to call this information more than once:
As solution and much better design attempt, please consider not modifying the public visible state during sending the request. Two possible attempts:
In my opinion the second option would be the better as it provides more flexibility and has a more straight forward design without implicit states of the object.
The text was updated successfully, but these errors were encountered: