add support for POST body

This commit is contained in:
Ali Alrahahleh 2016-05-10 14:36:53 -07:00
parent afdebbc3a2
commit 50dd9ff483
1 changed files with 7 additions and 1 deletions

View File

@ -244,8 +244,14 @@ func (h *HttpJson) sendRequest(serverURL string) (string, float64, error) {
}
// Create + send request
body := data.Encode()
body_attr := data.Get('__body')
if body_attr != "" {
list := strings.Split(data.Encode(), '=')
body = list[1]
}
req, err := http.NewRequest(h.Method, requestURL.String(),
strings.NewReader(data.Encode()))
strings.NewReader(body))
if err != nil {
return "", -1, err
}