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
These are very useful but I can only access the HTTP Headers for the request and the response and the response body. The only missing is the request body.
The BuildingRequest event seems to contain the required info, but it's not accessible publicly:
vardataServiceContext=new MyDataContext(new Uri("https://mydomain.com/data"));
dataServiceContext.BuildingRequest +=(objectsender,BuildingRequestEventArgse)=>{vardescriptor=((EntityDescriptor)e.Descriptor);varentity= descriptor.Entity; descriptor.PropertiesToSerialize // can't access because it is internal only};
When debugging you can see that PropertiesToSerialize contains the fields that will be serialized and it could be used to retrieve the field values from the Entity property using reflection, but the problem is that PropertiesToSerialize is internal. See screenshot
The text was updated successfully, but these errors were encountered:
Is there a way to access the underlying HTTP request body to log requests?
For example, when doing an update, the underlying HTTP request looks something like this:
I would like to access the request body (
{ "Quantity": 2, "Type": "Internal" }
) for logging/debugging purposes.Describe the solution you'd like
Maybe include a
RequestBody
property in thedataServiceContext.BuildingRequest
event? Or a different event?Describe alternatives you've considered
I looked into all of the events generated in the data context class:
These are very useful but I can only access the HTTP Headers for the request and the response and the response body. The only missing is the request body.
The
BuildingRequest
event seems to contain the required info, but it's not accessible publicly:When debugging you can see that
PropertiesToSerialize
contains the fields that will be serialized and it could be used to retrieve the field values from theEntity
property using reflection, but the problem is thatPropertiesToSerialize
is internal. See screenshotThe text was updated successfully, but these errors were encountered: