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
-13
View File
@@ -1,8 +1,6 @@
package reddit
import (
"errors"
"net/http"
"net/url"
"os"
)
@@ -10,17 +8,6 @@ import (
// Opt is used to further configure a client upon initialization.
type Opt func(*Client) error
// WithHTTPClient sets the HTTP client which will be used to make requests.
func WithHTTPClient(httpClient *http.Client) Opt {
return func(c *Client) error {
if httpClient == nil {
return errors.New("*http.Client: cannot be nil")
}
c.client = httpClient
return nil
}
}
// WithUserAgent sets the User-Agent header for requests made with the client.
// Reddit recommends the following format for the user agent:
// <platform>:<app ID>:<version string> (by /u/<reddit username>)