refactor: refactoring http request creation and sending (#395)
* refactoring http request creation and sending * fix lint error * increase the test coverage of client.go * refactor: Change the style of HTTPRequestBuilder.Build func to one-argument-per-line.
This commit is contained in:
committed by
GitHub
parent
157de0680f
commit
f1b66967a4
4
audio.go
4
audio.go
@@ -95,11 +95,11 @@ func (c *Client) callAudioAPI(
|
||||
}
|
||||
|
||||
urlSuffix := fmt.Sprintf("/audio/%s", endpointSuffix)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model), &formBody)
|
||||
req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix, request.Model),
|
||||
withBody(&formBody), withContentType(builder.FormDataContentType()))
|
||||
if err != nil {
|
||||
return AudioResponse{}, err
|
||||
}
|
||||
req.Header.Add("Content-Type", builder.FormDataContentType())
|
||||
|
||||
if request.HasJSONResponse() {
|
||||
err = c.sendRequest(req, &response)
|
||||
|
||||
Reference in New Issue
Block a user