slanatech/swagger-stats

Error in "body" stringification

Closed this issue · 3 comments

Hi!
I found an error in swsProcessor.prototype.collectRequestResponseData.
It was causing some API calls not to be logged, so I think it should be considered as important.
The problem resides on response bodies containing objects within a main object, otherwise it works well... arrays, etc... works fine.
I could fix it by adding this:

rrr.http.request.body = Object.assign({}, req.body);
swsUtil.swsStringRecursive(rrr.http.request.body, req.body);

I just added the Object.assign - beacuse the problem was within swsStringRecursive - it was lacking the first level of data.

Maybe it is not the best solution, I can send a PR if needed.

Thanks in advance,
Ignacio

sv2 commented

Thank you, would appreciate PR!

Thanks for merging this! Do you think this could be released (to npm) any time soon?

sv2 commented

Done :) Thank you!