Merge branch 'onpoint-stock-update' into develop
This commit is contained in:
commit
ea7d9768d0
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -210,17 +211,20 @@ func (c *Client) requestHttpViaNats(data model.CommunicationRequestHttp, res int
|
|||
if err != nil {
|
||||
return fmt.Errorf("onpoint: request via nats %v", err)
|
||||
}
|
||||
qs := ""
|
||||
for k, v := range data.Payload.Query {
|
||||
if qs != "" {
|
||||
qs += "&"
|
||||
}
|
||||
qs += k + "=" + v
|
||||
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 {
|
||||
q.Set(k, v)
|
||||
}
|
||||
u.RawQuery = q.Encode()
|
||||
|
||||
now := time.Now().Unix()
|
||||
ts := strconv.FormatInt(now, 10)
|
||||
arr := []string{
|
||||
qs,
|
||||
u.RawQuery,
|
||||
data.Payload.Data,
|
||||
ts,
|
||||
}
|
||||
|
@ -235,6 +239,7 @@ func (c *Client) requestHttpViaNats(data model.CommunicationRequestHttp, res int
|
|||
headerXTimestamp: ts,
|
||||
httputil.HeaderKeyContentType: httputil.HeaderValueApplicationJSON,
|
||||
}
|
||||
data.Payload.Query = map[string]string{}
|
||||
|
||||
return ec.Request(subject.Communication.RequestHTTP, data, res)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue