go-zero/rest/httpc/requests.go

22 lines
597 B
Go
Raw Normal View History

package httpc
import (
2022-03-13 14:49:14 +08:00
"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)
}
2022-03-13 14:49:14 +08:00
// 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)
2022-03-13 14:49:14 +08:00
}
// 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)
}