fix request paths
This commit is contained in:
parent
8192244fec
commit
abeb9655f9
|
@ -3,7 +3,7 @@ package panelapi
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pterodactyl/wings/api"
|
||||
|
@ -35,8 +35,9 @@ func CreateClient(base, tokenId, token string, opts ...ClientOption) Client {
|
|||
httpClient := &http.Client{
|
||||
Timeout: time.Second * 15,
|
||||
}
|
||||
base = strings.TrimSuffix(base, "/")
|
||||
c := &client{
|
||||
baseUrl: filepath.Join(base, "api/remote"),
|
||||
baseUrl: base + "/api/remote",
|
||||
tokenId: tokenId,
|
||||
token: token,
|
||||
httpClient: httpClient,
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pterodactyl/wings/system"
|
||||
)
|
||||
|
@ -35,7 +34,7 @@ type q map[string]string
|
|||
// Prefer request() over this method when possible.
|
||||
// It appends the path to the endpoint of the client and adds the authentication token to the request.
|
||||
func (c *client) requestOnce(ctx context.Context, method, path string, body io.Reader, opts ...func(r *http.Request)) (*Response, error) {
|
||||
req, err := http.NewRequest(method, filepath.Join(c.baseUrl, path), body)
|
||||
req, err := http.NewRequest(method, c.baseUrl+path, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user