fix request paths

This commit is contained in:
Jakob Schrettenbrunner 2021-01-10 00:24:07 +00:00
parent 8192244fec
commit abeb9655f9
2 changed files with 4 additions and 4 deletions

View File

@ -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,

View File

@ -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
}