google/go-github — pull request #69 by tbruyelle (2013-11-15 14:31:56+00:00)
Title: Improve UploadReleaseAsset usage

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