Use built in function for special FetchSessionKey
This commit is contained in:
parent
36ba50352a
commit
72862609c5
1 changed files with 3 additions and 1 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -198,7 +199,7 @@ func (c *Client) FetchSessionKey(privatekey string) error {
|
|||
query := form.Encode()
|
||||
|
||||
ctx := context.Background()
|
||||
req, err := c.newRequest(ctx, "POST", secretsPath+"/get-session-key/", "", query)
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", secretsPath+"/get-session-key/", strings.NewReader(query))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -213,6 +214,7 @@ func (c *Client) FetchSessionKey(privatekey string) error {
|
|||
req.Header.Add("Authorization", " Token "+c.Token)
|
||||
|
||||
var sessionkey NetBoxSessionKey
|
||||
|
||||
res, err := c.do(req, sessionkey)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue