what i have tried till now is like and http request formed now is:curl -X POST http://localhost:8080/v1.0
l_httpClient_ptr := http.Client{
Timeout: timeout,
}
var l_resp_ptr *http.Response
var l_resp_byte []byte
l_resp_ptr, r_err = l_httpClient_ptr.Post(p_url_str, "text/xml; charset=utf-8", bytes.NewBufferString(p_request_str))
l_resp_byte, r_err = ioutil.ReadAll(l_resp_ptr.Body)
l_resp_ptr.Body.Close()
r_response_str = string(l_resp_byte)
return
}
Here I am able to send only request xml along with URL. And with my code I don't know how to send Username and password along with url that is it should be like following URL:
curl -H "ChannelName: guest" -H "ChannelPassword: guest" -X POST http://localhost:8080/v1.0/
You can create a request with custom headers,like this:
req, err := http.NewRequest("POST", p_url_str, bytes.NewBufferString(p_request_str))
req.Header.Set("ChannelName", "guest")
req.Header.Set("ChannelPassword", "guest")
then execute this request with:
l_resp_byte, r_err := l_httpClient_ptr.Do(req)