@@ -25,9 +25,13 @@ func NewClient(client *gogithub.Client, rawURL *url.URL) *Client {
25
25
return & Client {client : client , url : rawURL }
26
26
}
27
27
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 ) {
29
29
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
31
35
}
32
36
33
37
func (c * Client ) refURL (owner , repo , ref , path string ) string {
@@ -60,7 +64,7 @@ type RawContentOpts struct {
60
64
// GetRawContent fetches the raw content of a file from a GitHub repository.
61
65
func (c * Client ) GetRawContent (ctx context.Context , owner , repo , path string , opts * RawContentOpts ) (* http.Response , error ) {
62
66
url := c .URLFromOpts (opts , owner , repo , path )
63
- req , err := c .newRequest ("GET" , url , nil )
67
+ req , err := c .newRequest (ctx , "GET" , url , nil )
64
68
if err != nil {
65
69
return nil , err
66
70
}
0 commit comments