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

Debug output for failing requests is output as raw bytes instead of ascii/utf8 encoded. #23

Open
jeffgran opened this issue Jun 15, 2022 · 1 comment

Comments

@jeffgran
Copy link
Contributor

│ Error: API Error Deleting Resource
│ 
│ Unexpected response code from API: 403
│ 
│ body:
│ 
│ [123 34 100 101 116 97 105 108 34 58 34 89 111 117 32 100 111 32 110 111
│ 116 32 104 97 118 101 32 112 101 114 109 105 115 115 105 111 110 32 116 111
│ 32 112 101 114 102 111 114 109 32 116 104 105 115 32 97 99 116 105 111 110
│ 46 34 125]
╵

Decoded:

puts "123 34 100 101 116 97 105 108 34 58 34 89 111 117 32 100 111 32 110 111 116 32 104 97 118 101 32 112 101 114 109 105 115 115 105 111 110 32 116 111 32 112 101 114 102 111 114 109 32 116 104 105 115 32 97 99 116 105 111 110 46 34 125".split.map(&:to_i).map(&:chr).join
#=> {"detail":"You do not have permission to perform this action."}
@keatly91
Copy link
Contributor

Since this provider uses https://pkg.go.dev/github.com/doximity/defect-dojo-client-go, I think calls to the client should use the ClientWithResponses functions since they already return the response body as a byte array. It will save a couple extra lines to get the byte array.

For example, go from:

resp, err := DestroyProducts(...)

...
body, _ := ioutil.ReadAll(resp.Body)

fmt.Println(string(body))

To:

resp, err := DestroyProductsWithResponse(...)

...

fmt.Println(string(resp.Body))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants