Actually encode JSON in RequestJSON90
Change-Id: I1e56927d3c100be1b59f00aaabd705bc3c38cd7b
This commit is contained in:
parent
e7fceb0b4d
commit
4141ca3ed3
@ -140,10 +140,15 @@ func (s *Session) RequestJSON(
|
||||
url string,
|
||||
params *url.Values,
|
||||
headers *http.Header,
|
||||
body *[]byte,
|
||||
body interface{},
|
||||
responseContainer interface{},
|
||||
) (resp *http.Response, err error) {
|
||||
resp, err = s.Request(method, url, params, headers, body)
|
||||
bodyjson, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err = s.Request(method, url, params, headers, &bodyjson)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -210,7 +215,7 @@ func (s *Session) PostJSON(
|
||||
url string,
|
||||
params *url.Values,
|
||||
headers *http.Header,
|
||||
body *[]byte,
|
||||
body interface{},
|
||||
responseContainer interface{},
|
||||
) (resp *http.Response, err error) {
|
||||
return s.RequestJSON("POST", url, params, headers, body, responseContainer)
|
||||
@ -272,7 +277,7 @@ func PostJSON(
|
||||
url string,
|
||||
params *url.Values,
|
||||
headers *http.Header,
|
||||
body *[]byte,
|
||||
body interface{},
|
||||
responseContainer interface{},
|
||||
) (resp *http.Response, err error) {
|
||||
s, _ := NewSession(nil, nil, nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user