code: func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64) (rc io.ReadCloser, redirectURL string, err error) {
  	u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
  
  	req, err := s.client.NewRequest("GET", u, nil)
  	if err != nil {
  		return nil, "", err
  	}
  	req.Header.Set("Accept", defaultMediaType)
  
  	s.client.clientMu.Lock()
  	defer s.client.clientMu.Unlock()
  
  	var loc string
  	saveRedirect := s.client.client.CheckRedirect
  	s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
  		loc = req.URL.String()
  		return errors.New("disable redirect")
  	}
  	defer func() { s.client.client.CheckRedirect = saveRedirect }()
  
  	req = withContext(ctx, req)
  	resp, err := s.client.client.Do(req)
  	if err != nil {
  		if !strings.Contains(err.Error(), "disable redirect") {
  			return nil, "", err
  		}
  		return nil, loc, nil // Intentionally return no error with valid redirect URL.
  	}
  
  	if err := CheckResponse(resp); err != nil {
  		resp.Body.Close()
  		return nil, "", err
  	}
  
  	return resp.Body, "", nil
  }
docs: // DownloadReleaseAsset downloads a release asset or returns a redirect URL.
  //
  // DownloadReleaseAsset returns an io.ReadCloser that reads the contents of the
  // specified release asset. It is the caller's responsibility to close the ReadCloser.
  // If a redirect is returned, the redirect URL will be returned as a string instead
  // of the io.ReadCloser. Exactly one of rc and redirectURL will be zero.
  //
  // GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset