mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 15:10:54 +00:00
simple common helper to parse & return path (for hmac etc) given url
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -338,3 +339,15 @@ func WriteFile(file string, data []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetURIPath returns the path of a URL given a URL
|
||||
func GetURIPath(uri string) string {
|
||||
urip, err := url.Parse(uri)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
if urip.RawQuery != "" {
|
||||
return fmt.Sprintf("%s?%s", urip.Path, urip.RawQuery)
|
||||
}
|
||||
return urip.Path
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user