mirror of
https://github.com/kerberos-io/onvif.git
synced 2026-08-23 15:08:33 +00:00
add SendSoapWithTimeout
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package networking
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"bytes"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// SendSoap send soap message
|
||||
func SendSoap(endpoint, message string) (*http.Response, error) {
|
||||
httpClient := new(http.Client)
|
||||
|
||||
@@ -13,5 +15,14 @@ func SendSoap(endpoint, message string) (*http.Response, error) {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp,nil
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// SendSoapWithTimeout send soap message with timeOut
|
||||
func SendSoapWithTimeout(endpoint string, message []byte, timeout time.Duration) (*http.Response, error) {
|
||||
httpClient := &http.Client{
|
||||
Timeout: timeout,
|
||||
}
|
||||
|
||||
return httpClient.Post(endpoint, "application/soap+xml; charset=utf-8", bytes.NewReader(message))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user