4

The basic example provided by Microsoft when I add the Log to EventHub action to my Incoming processing is useful but I want to be able to log the Request Content and Content Length. Currently I cannot find any documentation or definitions of the context or context.Request objects used in this example.

<log-to-eventhub logger-id ='logger-id'>
  @( string.Join(",", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name))
</log-to-eventhub>

Can someone please point me to the documentation for this, or at least tell me how to get the content of the request body or the body length?

Mr_road
  • 554
  • 6
  • 25

1 Answers1

5

Here is how you can get the body:

string inBody = context.Request.Body.As<string>(preserveContent: true); 

For more information, see the context, context.Request and IMessage sections in the Context variable table.

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107