add testable json marshaller (#161)

This commit is contained in:
sashabaranov
2023-03-15 12:16:47 +04:00
committed by GitHub
parent ba77a6476e
commit 53d195cf5a
10 changed files with 102 additions and 18 deletions

View File

@@ -3,7 +3,6 @@ package openai
import (
"bytes"
"context"
"encoding/json"
"io"
"mime/multipart"
"net/http"
@@ -47,7 +46,7 @@ type ImageResponseDataInner struct {
// CreateImage - API call to create an image. This is the main endpoint of the DALL-E API.
func (c *Client) CreateImage(ctx context.Context, request ImageRequest) (response ImageResponse, err error) {
var reqBytes []byte
reqBytes, err = json.Marshal(request)
reqBytes, err = c.marshaller.marshal(request)
if err != nil {
return
}