mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 01:30:25 +08:00
22 lines
597 B
Go
22 lines
597 B
Go
package httpc
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
)
|
|
|
|
// Do sends an HTTP request to the service assocated with the given key.
|
|
func Do(key string, r *http.Request) (*http.Response, error) {
|
|
return NewService(key).Do(r)
|
|
}
|
|
|
|
// Get sends an HTTP GET request to the service assocated with the given key.
|
|
func Get(key, url string) (*http.Response, error) {
|
|
return NewService(key).Get(url)
|
|
}
|
|
|
|
// Post sends an HTTP POST request to the service assocated with the given key.
|
|
func Post(key, url, contentType string, body io.Reader) (*http.Response, error) {
|
|
return NewService(key).Post(url, contentType, body)
|
|
}
|