Skip to content

Commit 66bae3e

Browse files
grulexgrulexsashabaranov
authored
Content-type fix (#659)
* charset fixes * make linter happy (#661) --------- Co-authored-by: grulex <[email protected]> Co-authored-by: Alexander Baranov <[email protected]>
1 parent 11ad4b6 commit 66bae3e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ func (c *Client) newRequest(ctx context.Context, method, url string, setters ...
107107
}
108108

109109
func (c *Client) sendRequest(req *http.Request, v Response) error {
110-
req.Header.Set("Accept", "application/json; charset=utf-8")
110+
req.Header.Set("Accept", "application/json")
111111

112112
// Check whether Content-Type is already set, Upload Files API requires
113113
// Content-Type == multipart/form-data
114114
contentType := req.Header.Get("Content-Type")
115115
if contentType == "" {
116-
req.Header.Set("Content-Type", "application/json; charset=utf-8")
116+
req.Header.Set("Content-Type", "application/json")
117117
}
118118

119119
res, err := c.config.HTTPClient.Do(req)

speech.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (c *Client) CreateSpeech(ctx context.Context, request CreateSpeechRequest)
7676
}
7777
req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/audio/speech", string(request.Model)),
7878
withBody(request),
79-
withContentType("application/json; charset=utf-8"),
79+
withContentType("application/json"),
8080
)
8181
if err != nil {
8282
return

0 commit comments

Comments
 (0)