feat(onpoint): fix OP sign
This commit is contained in:
parent
76eeabdf7f
commit
2bf7ef6e8a
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -209,17 +210,20 @@ func (c *Client) requestHttpViaNats(data model.CommunicationRequestHttp, res int
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("onpoint: request via nats %v", err)
|
return fmt.Errorf("onpoint: request via nats %v", err)
|
||||||
}
|
}
|
||||||
qs := ""
|
u, err := url.ParseRequestURI(data.Payload.URL)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("onpoint: request via nats %v", err)
|
||||||
|
}
|
||||||
|
q := u.Query()
|
||||||
for k, v := range data.Payload.Query {
|
for k, v := range data.Payload.Query {
|
||||||
if qs != "" {
|
q.Set(k, v)
|
||||||
qs += "&"
|
|
||||||
}
|
|
||||||
qs += k + "=" + v
|
|
||||||
}
|
}
|
||||||
|
u.RawQuery = q.Encode()
|
||||||
|
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
ts := strconv.FormatInt(now, 10)
|
ts := strconv.FormatInt(now, 10)
|
||||||
arr := []string{
|
arr := []string{
|
||||||
qs,
|
u.RawQuery,
|
||||||
data.Payload.Data,
|
data.Payload.Data,
|
||||||
ts,
|
ts,
|
||||||
}
|
}
|
||||||
|
@ -232,6 +236,7 @@ func (c *Client) requestHttpViaNats(data model.CommunicationRequestHttp, res int
|
||||||
headerXTimestamp: ts,
|
headerXTimestamp: ts,
|
||||||
httputil.HeaderKeyContentType: httputil.HeaderValueApplicationJSON,
|
httputil.HeaderKeyContentType: httputil.HeaderValueApplicationJSON,
|
||||||
}
|
}
|
||||||
|
data.Payload.Query = map[string]string{}
|
||||||
|
|
||||||
return ec.Request(subject.Communication.RequestHTTP, data, res)
|
return ec.Request(subject.Communication.RequestHTTP, data, res)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue