|
5 | 5 | "context"
|
6 | 6 | "encoding/json"
|
7 | 7 | "fmt"
|
8 |
| - "io/ioutil" |
| 8 | + "io" |
9 | 9 | "log"
|
10 | 10 | "net/http"
|
11 | 11 | "net/http/httptest"
|
@@ -207,7 +207,7 @@ func TestImages(t *testing.T) {
|
207 | 207 | func getEditBody(r *http.Request) (EditsRequest, error) {
|
208 | 208 | edit := EditsRequest{}
|
209 | 209 | // read the request body
|
210 |
| - reqBody, err := ioutil.ReadAll(r.Body) |
| 210 | + reqBody, err := io.ReadAll(r.Body) |
211 | 211 | if err != nil {
|
212 | 212 | return EditsRequest{}, err
|
213 | 213 | }
|
@@ -308,7 +308,7 @@ func handleCompletionEndpoint(w http.ResponseWriter, r *http.Request) {
|
308 | 308 | func getCompletionBody(r *http.Request) (CompletionRequest, error) {
|
309 | 309 | completion := CompletionRequest{}
|
310 | 310 | // read the request body
|
311 |
| - reqBody, err := ioutil.ReadAll(r.Body) |
| 311 | + reqBody, err := io.ReadAll(r.Body) |
312 | 312 | if err != nil {
|
313 | 313 | return CompletionRequest{}, err
|
314 | 314 | }
|
@@ -358,7 +358,7 @@ func handleImageEndpoint(w http.ResponseWriter, r *http.Request) {
|
358 | 358 | func getImageBody(r *http.Request) (ImageRequest, error) {
|
359 | 359 | image := ImageRequest{}
|
360 | 360 | // read the request body
|
361 |
| - reqBody, err := ioutil.ReadAll(r.Body) |
| 361 | + reqBody, err := io.ReadAll(r.Body) |
362 | 362 | if err != nil {
|
363 | 363 | return ImageRequest{}, err
|
364 | 364 | }
|
@@ -417,7 +417,7 @@ func handleModerationEndpoint(w http.ResponseWriter, r *http.Request) {
|
417 | 417 | func getModerationBody(r *http.Request) (ModerationRequest, error) {
|
418 | 418 | moderation := ModerationRequest{}
|
419 | 419 | // read the request body
|
420 |
| - reqBody, err := ioutil.ReadAll(r.Body) |
| 420 | + reqBody, err := io.ReadAll(r.Body) |
421 | 421 | if err != nil {
|
422 | 422 | return ModerationRequest{}, err
|
423 | 423 | }
|
|
0 commit comments