refactor: use http.NewRequestWithContext instead of http.NewRequest (#97)
This commit is contained in:
3
chat.go
3
chat.go
@@ -67,12 +67,11 @@ func (c *Client) CreateChatCompletion(
|
||||
}
|
||||
|
||||
urlSuffix := "/chat/completions"
|
||||
req, err := http.NewRequest("POST", c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes))
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
req = req.WithContext(ctx)
|
||||
err = c.sendRequest(req, &response)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user