@@ -25,9 +25,13 @@ func NewClient(client *gogithub.Client, rawURL *url.URL) *Client {
2525 return & Client {client : client , url : rawURL }
2626}
2727
28- func (c * Client ) newRequest (method string , urlStr string , body interface {}, opts ... gogithub.RequestOption ) (* http.Request , error ) {
28+ func (c * Client ) newRequest (ctx context. Context , method string , urlStr string , body interface {}, opts ... gogithub.RequestOption ) (* http.Request , error ) {
2929 req , err := c .client .NewRequest (method , urlStr , body , opts ... )
30- return req , err
30+ if err != nil {
31+ return nil , err
32+ }
33+ req = req .WithContext (ctx )
34+ return req , nil
3135}
3236
3337func (c * Client ) refURL (owner , repo , ref , path string ) string {
@@ -60,7 +64,7 @@ type RawContentOpts struct {
6064// GetRawContent fetches the raw content of a file from a GitHub repository.
6165func (c * Client ) GetRawContent (ctx context.Context , owner , repo , path string , opts * RawContentOpts ) (* http.Response , error ) {
6266 url := c .URLFromOpts (opts , owner , repo , path )
63- req , err := c .newRequest ("GET" , url , nil )
67+ req , err := c .newRequest (ctx , "GET" , url , nil )
6468 if err != nil {
6569 return nil , err
6670 }
0 commit comments