requests.go 597 B

123456789101112131415161718192021
  1. package httpc
  2. import (
  3. "io"
  4. "net/http"
  5. )
  6. // Do sends an HTTP request to the service assocated with the given key.
  7. func Do(key string, r *http.Request) (*http.Response, error) {
  8. return NewService(key).Do(r)
  9. }
  10. // Get sends an HTTP GET request to the service assocated with the given key.
  11. func Get(key, url string) (*http.Response, error) {
  12. return NewService(key).Get(url)
  13. }
  14. // Post sends an HTTP POST request to the service assocated with the given key.
  15. func Post(key, url, contentType string, body io.Reader) (*http.Response, error) {
  16. return NewService(key).Post(url, contentType, body)
  17. }