mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Move HTTP client to its own package
This commit is contained in:
parent
04adf5fdf5
commit
1eba1730d1
13 changed files with 64 additions and 64 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/miniflux/miniflux/http"
|
||||
"github.com/miniflux/miniflux/http/client"
|
||||
)
|
||||
|
||||
// Client represents an Instapaper client.
|
||||
|
@ -24,8 +24,9 @@ func (c *Client) AddURL(link, title string) error {
|
|||
values.Add("title", title)
|
||||
|
||||
apiURL := "https://www.instapaper.com/api/add?" + values.Encode()
|
||||
client := http.NewClientWithCredentials(apiURL, c.username, c.password)
|
||||
response, err := client.Get()
|
||||
clt := client.New(apiURL)
|
||||
clt.WithCredentials(c.username, c.password)
|
||||
response, err := clt.Get()
|
||||
if response.HasServerFailure() {
|
||||
return fmt.Errorf("instapaper: unable to send url, status=%d", response.StatusCode)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue