From 1eba1730d1af50ed545f4fde78b22d6fb62ca11e Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 28 Apr 2018 10:51:07 -0700 Subject: Move HTTP client to its own package --- integration/wallabag/wallabag.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'integration/wallabag') diff --git a/integration/wallabag/wallabag.go b/integration/wallabag/wallabag.go index fbb100a..58d9c5b 100644 --- a/integration/wallabag/wallabag.go +++ b/integration/wallabag/wallabag.go @@ -10,7 +10,7 @@ import ( "io" "net/url" - "github.com/miniflux/miniflux/http" + "github.com/miniflux/miniflux/http/client" ) // Client represents a Wallabag client. @@ -38,8 +38,9 @@ func (c *Client) createEntry(accessToken, link, title string) error { return fmt.Errorf("wallbag: unable to get entries endpoint: %v", err) } - client := http.NewClientWithAuthorization(endpoint, "Bearer "+accessToken) - response, err := client.PostJSON(map[string]string{"url": link, "title": title}) + clt := client.New(endpoint) + clt.WithAuthorization("Bearer " + accessToken) + response, err := clt.PostJSON(map[string]string{"url": link, "title": title}) if err != nil { return fmt.Errorf("wallabag: unable to post entry: %v", err) } @@ -64,8 +65,8 @@ func (c *Client) getAccessToken() (string, error) { return "", fmt.Errorf("wallbag: unable to get token endpoint: %v", err) } - client := http.NewClient(endpoint) - response, err := client.PostForm(values) + clt := client.New(endpoint) + response, err := clt.PostForm(values) if err != nil { return "", fmt.Errorf("wallabag: unable to get access token: %v", err) } -- cgit v1.2.3