test
This commit is contained in:
parent
cc8fc2df21
commit
c34e5579fc
@ -5,6 +5,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTP Method Enum defines the different methods that can be used to interact with the HTTP server
|
// HTTP Method Enum defines the different methods that can be used to interact with the HTTP server
|
||||||
@ -139,3 +141,21 @@ func (caller *HTTPCaller) CallRaw(method string, url string, subpath string,
|
|||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
return client.Do(req)
|
return client.Do(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CallRaw calls the Raw method on the HTTP server
|
||||||
|
func (caller *HTTPCaller) CallForm(method string, url string, subpath string,
|
||||||
|
body url.Values, content_type string, fakeTLSTermination bool, cookies ...*http.Cookie) (*http.Response, error) {
|
||||||
|
req, err := http.NewRequest(method, url+subpath, strings.NewReader(body.Encode()))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
req.Header.Set("Content-Type", content_type)
|
||||||
|
if fakeTLSTermination {
|
||||||
|
req.Header.Add("X-Forwarded-Proto", "https")
|
||||||
|
}
|
||||||
|
for _, c := range cookies {
|
||||||
|
req.AddCookie(c)
|
||||||
|
}
|
||||||
|
client := &http.Client{}
|
||||||
|
return client.Do(req)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user