When checking the response of a request executed with Cloud SDK, we see that FluentHelperByKey does not have any headers. FluentHelperByKey is returned for successful requests. For erroneous ones, we receive FluentHelperCreate which includes headers.
I would expect both objects to be aligned. Either both returned headers or only one of them is used.
The request is referring to the executeRequest method within different FluentHelpers. e.g.
FluentHelperByKey -> EntityT
FluentHelperRead -> List<EntityT>
FluentHelperCreate -> ModificationResponse<EntityT>
In the first two variants we only get the result as defined Entities, whereas in the third option we also get access to further response attributes such as headers and status code. Would it be possible to provide a common access point to retrieve generic request/response attributes in all kinds of FluentHelpers like in the FluentHelperCreate?
Yes, this is the Generic OData Client. Let's motivate the use case...
Suggestion
If you want both executions to return your target
T entity, please consider casting to Generic OData Client:Please find other options for deserialization, header- and error-handling in the
ODataRequestResultGenericobject.API definition
For OData V2
FluentHelperCreate<?,T>#executeRequest(..)returnsModificationResponse<T>FluentHelperByKey<?,T>#executeRequest(..)returnsTFor OData V4
CreateRequestBuilder<T>#execute(..)returnsModificationResponse<T>GetByKeyRequestBuilder<T>#execute(..)returnsTFor Generic OData Client
ODataRequestCreate#execute(..)returnsODataRequestResultGenericODataRequestReadByKey#execute(..)returnsODataRequestResultGenericODataRequestResultGeneric#as(ClassT.class)returnsT<-- YOU WANT THISCasting from OData V2 to Generic OData Client:
FluentHelperCreate<?,T>#toRequest()returnsODataRequestCreateFluentHelperByKey<?,T>#toRequest()returnsODataRequestReadByKeyCasting from OData V4 to Generic OData Client:
FluentHelperCreate<?,T>#toRequest()returnsODataRequestCreateFluentHelperByKey<?,T>#toRequest()returnsODataRequestReadByKeyOutlook
We will likely not change the API for OData v2 and OData v4 anytime soon. In cases like this we recommend (casting to) the Generic OData Client.