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

Fix ChangeFileContentInChangeEdit function error

Open jackbai233 opened this issue 11 months ago • 0 comments

os:

  • Gerrit server version: 3.4.1

desc:

When I try to use the ChangeFileContentInChangeEdit function to update (or create) file in the remote gerrit server, although no error is reported, the local update content cannot be uploaded to the remote file. After I used chrome developer tools to manually debug and compare, I found that it was an api request header problem:here. After setting the request header to be the same as in chrome:

req.Header.Add("Accept", "*/*")
req.Header.Add("Content-Type", "text/plain")

or delete the json setting:

// req.Header.Add("Accept", "application/json")
// req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

then call this function, the file content can be updated remote server normally.

jackbai233 avatar Feb 29 '24 11:02 jackbai233