2022-03-13 14:11:14 +08:00
|
|
|
package httpc
|
|
|
|
|
|
|
|
import (
|
2022-03-13 14:49:14 +08:00
|
|
|
"io"
|
2022-03-13 14:11:14 +08:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Do sends an HTTP request to the service assocated with the given key.
|
2022-03-15 14:18:46 +08:00
|
|
|
func Do(key string, r *http.Request) (*http.Response, error) {
|
|
|
|
return NewService(key).Do(r)
|
2022-03-13 14:11:14 +08:00
|
|
|
}
|
|
|
|
|
2022-03-13 14:49:14 +08:00
|
|
|
// Get sends an HTTP GET request to the service assocated with the given key.
|
2022-03-15 14:18:46 +08:00
|
|
|
func Get(key, url string) (*http.Response, error) {
|
|
|
|
return NewService(key).Get(url)
|
2022-03-13 14:49:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Post sends an HTTP POST request to the service assocated with the given key.
|
2022-03-15 14:18:46 +08:00
|
|
|
func Post(key, url, contentType string, body io.Reader) (*http.Response, error) {
|
|
|
|
return NewService(key).Post(url, contentType, body)
|
2022-03-13 14:11:14 +08:00
|
|
|
}
|