@@ -44,7 +44,7 @@ xhttp.DefaultOptions.DebugFunc = func(l *Log) {
4444f := func (l *Log) {
4545 log.Println (l)
4646}
47- xhttp.NewRequest ( " POST" , url, xhttp.WithDebugFunc (f))
47+ xhttp.Fetch (context. Background (), " POST" , url, xhttp.WithDebugFunc (f))
4848```
4949
5050The log object contains the following fields
@@ -74,7 +74,7 @@ retryIf := func(resp *xhttp.Response, err error) error {
7474 }
7575 return nil
7676}
77- resp , err := xhttp.Fetch (" GET" , url, xhttp.WithRetry (retryIf, retry.Attempts (2 )))
77+ resp , err := xhttp.Fetch (context. Background (), " GET" , url, xhttp.WithRetry (retryIf, retry.Attempts (2 )))
7878```
7979
8080Network error, no retry.
@@ -90,7 +90,7 @@ retryIf := func(resp *xhttp.Response, err error) error {
9090 }
9191 return nil
9292}
93- resp , err := xhttp.Fetch (" GET" , url, xhttp.WithRetry (retryIf, retry.Attempts (2 )))
93+ resp , err := xhttp.Fetch (context. Background (), " GET" , url, xhttp.WithRetry (retryIf, retry.Attempts (2 )))
9494```
9595
9696## Middleware
@@ -112,7 +112,7 @@ logicMiddleware := func(next xhttp.HandlerFunc) xhttp.HandlerFunc {
112112 return resp, err
113113 }
114114}
115- resp , err := xhttp.Fetch (" GET" , " https://github.com/" , xhttp.WithMiddleware (logicMiddleware))
115+ resp , err := xhttp.Fetch (context. Background (), " GET" , " https://github.com/" , xhttp.WithMiddleware (logicMiddleware))
116116```
117117
118118## Shutdown
0 commit comments