working commit
This commit is contained in:
+21
-4
@@ -13,17 +13,34 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
//"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
//"net/url"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
//"mstore/app/handler"
|
||||
//"mstore/app/operator"
|
||||
"mstore/pkg/auxhttp"
|
||||
)
|
||||
|
||||
func setApiPath(base, apipath string) (string, error) {
|
||||
var res string
|
||||
if !strings.Contains(base, "://") {
|
||||
base = "https://" + base
|
||||
}
|
||||
uri, err := url.Parse(base)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
uri.Path = "/"
|
||||
uri.Path, err = url.JoinPath(uri.Path, apipath)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res = uri.String()
|
||||
return res, nil
|
||||
|
||||
}
|
||||
|
||||
func doHTTPCall(ctx context.Context, apiuri string, reqBytes []byte) ([]byte, error) {
|
||||
var err error
|
||||
respBytes := make([]byte, 0)
|
||||
|
||||
Reference in New Issue
Block a user