Tyk Analytics - RawRequest does not include actual request body for certain Response Code

Hi everyone,

I’ve encountered an interesting behavior from enabling Detailed Logging in an API. Somehow, the recorded request both in Tyk Pump CSV and Tyk Dashboard only show the request headers (such as Host, Content-Length, Content-Type, etc) but not the actual Request Body. This behavior only occurs when the API response code is 200 or 500. However, when the response code is 4xx the actual Request Body appear as expected.

In addition, in every response code, the actual Response Body data is shown correctly.

I’m wondering is this an expected behavior from Tyk Analytics or is there other explanation for this behavior?

Edit : It seems that in some cases, the RawRequest’s body is printed in the Dashboard analytics data but in incomplete form.

Thanks.

Hello Nicotanzil,

The reason some request bodies appear only for 4xx responses is due to how HTTP request streams work. For 4xx errors, the request is rejected early, so the body hasn’t been read yet and can be captured. For 200 or 500 responses, the request body is consumed by the upstream API before Tyk’s analytics runs, so it may be missing or incomplete. Response bodies, on the other hand, are always captured because Tyk intercepts them after they’re generated.

We hope this explanation is helpful.

Regards