If `RepositoriesService.DownloadReleaseAsset` encounters an error from
the GitHub API (e.g., 404 Not Found), The error would not be returned
by the method and instead the error payload would be delivered as the
`io.ReadCloser`. This patch resolves this with `CheckResponse`.
Fixes#343
If a redirect to AWS occurs, then the redirect will be canceled and
the redirect Location will be returned in redirectURL and the
io.ReadCloser will be nil. At this point, the user would need to
perform the http.Get with the redirectURL in a different http.Client
(without the GitHub authentication transport).
Note that this is a breaking API change.
Fixes#246.
Change-Id: I4fe2dfc9cd0ce81934a07f11a6296e71c7dd51a0
The release assets are included in the release object, but they are not being
parsed currently. To get the list of release assets, one must use
ListReleaseAssets, which is one extra unnecessary HTTP request.
This commit adds Assets field to RepositoryRelease struct so that the release
assets are immediately available right after calling ListReleases.
Signed-off-by: Ondřej Kupka <ondra.cap@gmail.com>
This includes all of the methods mentioned in this blog post:
https://developer.github.com/changes/2014-03-18-paginating-method-changes/
as well as a handful of others I found. Sadly, this is a breaking
change for many of these methods because it changes the method
signature, but with yesterday's API change these methods are now broken
anyway. :(
Inspired by the Ruby version [1], UploadReleaseAsset now accepts a
simple path to a file.
The Content-Type is now determined internally using the
mime.TypeByExtension() function.
Note this version is also more flexible. Indeed, the previous version
needed an io.Reader, but actually only 3 kinds of io.Reader were bore.
This is because of http.NewRequest needs to determine the Content-Length
of the body, and it can only determine it for bytes.Buffer, bytes.Reader
or strings.Reader [2]. Note there is an issue raised about this [3].
With a path to a file, we can easily determine the file size, and then
manually add it to the request.
[1]
https://github.com/octokit/octokit.rb/blob/master/lib/octokit/client/releases.rb#L85
[2] http://golang.org/src/pkg/net/http/request.go#L447
[3] https://code.google.com/p/go/issues/detail?id=6738