feat: add httpc.Parse (#1698)

This commit is contained in:
Kevin Wan
2022-03-23 17:58:21 +08:00
committed by GitHub
parent 0aeb49a6b0
commit c1d9e6a00b
10 changed files with 178 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ import (
func TestLogInterceptor(t *testing.T) {
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
}))
defer svr.Close()
req, err := http.NewRequest(http.MethodGet, svr.URL, nil)
assert.Nil(t, err)
req, handler := LogInterceptor(req)
@@ -24,6 +25,7 @@ func TestLogInterceptorServerError(t *testing.T) {
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
}))
defer svr.Close()
req, err := http.NewRequest(http.MethodGet, svr.URL, nil)
assert.Nil(t, err)
req, handler := LogInterceptor(req)