Skip to content

Commit

Permalink
Merge pull request #3 from sightmachine/new-request
Browse files Browse the repository at this point in the history
New request
  • Loading branch information
Juhibhadviya19 authored Jun 15, 2020
2 parents 9102de5 + c190cf0 commit 54b59e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pingdom/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"io/ioutil"
"strconv"
"fmt"
)

// CheckService provides an interface to Pingdom checks.
Expand Down Expand Up @@ -31,7 +32,7 @@ func (cs *CheckService) List(params ...map[string]string) ([]CheckResponse, erro
if err != nil {
return nil, err
}

resp, err := cs.client.client.Do(req)
if err != nil {
return nil, err
Expand Down
7 changes: 4 additions & 3 deletions pingdom/pingdom.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
defaultBaseURL = "https://api.pingdom.com/api/2.1"
defaultBaseURL = "https://api.pingdom.com/api/3.1"
)

// Client represents a client to the Pingdom API. This package also
Expand Down Expand Up @@ -122,8 +122,9 @@ func (pc *Client) NewRequest(method string, rsc string, params map[string]string
}

req, err := http.NewRequest(method, baseURL.String(), nil)
req.SetBasicAuth(pc.User, pc.Password)
req.Header.Add("Bearer", pc.APIKey)
// req.SetBasicAuth(pc.User, pc.Password)
bearer := "Bearer " + pc.APIKey
req.Header.Add("Authorization", bearer)
if pc.AccountEmail != "" {
req.Header.Add("Account-Email", pc.AccountEmail)
}
Expand Down

0 comments on commit 54b59e5

Please sign in to comment.