feat: add httpc.Parse (#1698)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
func TestNamedService_Do(t *testing.T) {
|
||||
svr := httptest.NewServer(http.RedirectHandler("/foo", http.StatusMovedPermanently))
|
||||
defer svr.Close()
|
||||
req, err := http.NewRequest(http.MethodGet, svr.URL, nil)
|
||||
assert.Nil(t, err)
|
||||
service := NewService("foo")
|
||||
@@ -22,6 +23,7 @@ func TestNamedService_Get(t *testing.T) {
|
||||
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("foo", r.Header.Get("foo"))
|
||||
}))
|
||||
defer svr.Close()
|
||||
service := NewService("foo", func(r *http.Request) *http.Request {
|
||||
r.Header.Set("foo", "bar")
|
||||
return r
|
||||
@@ -34,6 +36,7 @@ func TestNamedService_Get(t *testing.T) {
|
||||
|
||||
func TestNamedService_Post(t *testing.T) {
|
||||
svr := httptest.NewServer(http.NotFoundHandler())
|
||||
defer svr.Close()
|
||||
service := NewService("foo")
|
||||
_, err := service.Post("tcp://bad request", "application/json", nil)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
Reference in New Issue
Block a user