Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response body doesn't appear to log correctly in SDKLogger #93

Closed
1 of 5 tasks
zbuchheit opened this issue Dec 4, 2024 · 6 comments · Fixed by #94
Closed
1 of 5 tasks

Response body doesn't appear to log correctly in SDKLogger #93

zbuchheit opened this issue Dec 4, 2024 · 6 comments · Fixed by #94
Labels
bug Something isn't working

Comments

@zbuchheit
Copy link

Describe the bug
A clear and concise description of what the bug is.

Where did you find this bug?

  • ApiError Package
  • Https Package
  • TestHelper Package
  • Utilities Package
  • Logger Package

Expected behavior
I would expect the response body to be correctly logged

To Reproduce
Steps to reproduce the bug:

Code Link
It appears the issue stems from the below code. Body is type io.ReadCloser so this doesn't work correctly.

if bodyBytes, err := json.Marshal(response.Body); err == nil {

Library version number
For example: 0.1.1

Environmental details
For example:
OS: Linux
Runtime version: GO 1.18

Additional context
Add any other context about the problem here.

@zbuchheit zbuchheit added the bug Something isn't working label Dec 4, 2024
@haseeb-mhr
Copy link
Collaborator

@zbuchheit Thank you for reporting this issue!
To help us better diagnose the problem, please share sample inputs or code snippets that consistently reproduce the issue. Alternatively, please elaborate on the differences between the expected and actual log outputs you're observing.

@zbuchheit
Copy link
Author

I don't suspect any use of logging a body here should work. Do you have an example of logging the body of a response successfully? I don't think you can json.Marshal(response.Body); and it work. In my testing, json.Marshal ends up just converting response.Body to be {}

@zbuchheit
Copy link
Author

have you been able to replicate the behavior @haseeb-mhr

@haseeb-mhr
Copy link
Collaborator

@zbuchheit Thank you for bringing this to our attention. I have replicated the behavior and working on implementing a fix for it.

@zbuchheit
Copy link
Author

great news! Thank you!

@haseeb-mhr
Copy link
Collaborator

@zbuchheit The changes have been released. Please bump to the latest version to incorporate the fix. Let me know if you encounter any further issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants