initial attempt to integrate surf http client

This commit is contained in:
2026-01-24 14:59:48 -06:00
parent 2f1019d170
commit 538d52d064
45 changed files with 196 additions and 109 deletions
+8 -5
View File
@@ -6,16 +6,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/enetx/http"
"io"
"mime/multipart"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"github.com/google/go-querystring/query"
"golang.org/x/net/context/ctxhttp"
)
// EmojiService handles communication with the emoji
@@ -242,14 +241,18 @@ func (s *EmojiService) Upload(ctx context.Context, subreddit string, createReque
return nil, err
}
httpResponse, err := ctxhttp.Post(ctx, nil, uploadURL, writer.FormDataContentType(), body)
req, err := http.NewRequest(http.MethodPost, uploadURL, body)
if err != nil {
return nil, err
}
resp, err = s.client.Do(ctx, req, nil)
if err != nil {
return nil, err
}
err = CheckResponse(httpResponse)
err = CheckResponse(resp.Response)
if err != nil {
return newResponse(httpResponse), err
return newResponse(resp.Response), err
}
return s.upload(ctx, subreddit, createRequest, fields["key"])