When attempting to commit an empty file to a repository using ghClient.Repositories.CreateFile and passing in []byte{} under the Content field of a github.RepositoryContentFileOptions the GitHub API will return a 422 error stating that content was not supplied. This is most likely due to the line:
|
Content []byte `json:"content,omitempty"` // unencoded |
Which adds omitempty to the Content field of github.RepositoryContentFileOptions, even though it is a necessary field of the request.
When attempting to commit an empty file to a repository using
ghClient.Repositories.CreateFileand passing in[]byte{}under theContentfield of agithub.RepositoryContentFileOptionsthe GitHub API will return a422error stating thatcontentwas not supplied. This is most likely due to the line:go-github/github/repos_contents.go
Line 54 in 7a7a7f0
Which adds
omitemptyto theContentfield ofgithub.RepositoryContentFileOptions, even though it is a necessary field of the request.