go-gerrit icon indicating copy to clipboard operation
go-gerrit copied to clipboard

fix: handle changes/<change>/patch JSON marshalling error

Open ShashankYadav opened this issue 8 months ago • 1 comments

The changes//revisions//patch endpoint in gerrit returns a base64 encoded diff by default, which cannot be marshalled as JSON. Creating a unit test for the patch endpoint results in the 'invalid character looking for beginning of value` error (same as https://github.com/andygrunwald/go-gerrit/issues/166).

This change fixes the issue by providing an input to Client.Do() which implements the Writer interface to avoid the JSON marshalling by Client.Do() and allow the caller to handle the response appropriately.

ShashankYadav avatar May 07 '25 17:05 ShashankYadav

Thank you. I will have a look at this, but it may need a bit of time.

Note for myself: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-patch

@dmitshur If you have time to look into it, I would appreciate it.

andygrunwald avatar May 09 '25 06:05 andygrunwald