Use Host from URL as fallback

This commit is contained in:
DataHoarder 2022-06-11 14:45:31 +02:00
parent 66c542ecec
commit e5709f249b
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

5
api.go
View file

@ -29,6 +29,11 @@ func (c *Client) Do(req *http.Request) (*http.Response, error) {
expirationTime = time.Now().Add(c.RequestExpirationTime)
}
host := req.Host
if host == "" {
host = req.URL.Host
}
newUrl, err := CreateSignatureMessage(req.Method, req.Host, req.URL, c.privateKey, expirationTime)
if err != nil {
return nil, err