mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
Fix fetch example
This commit is contained in:
parent
ed546fec09
commit
fcca3fd39a
@ -32,7 +32,7 @@ func handler(w http.ResponseWriter, req *http.Request) {
|
||||
// responds with origin server
|
||||
fc := fetch.NewClient()
|
||||
proxy := httputil.ReverseProxy{
|
||||
Transport: fc.HTTPClient().Transport,
|
||||
Transport: fc.HTTPClient(fetch.RedirectModeManual).Transport,
|
||||
Director: func(r *http.Request) {
|
||||
r.URL = req.URL
|
||||
},
|
||||
|
@ -21,7 +21,7 @@ func main() {
|
||||
}
|
||||
r.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0")
|
||||
|
||||
res, err := cli.Do(r)
|
||||
res, err := cli.Do(r, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
Loading…
x
Reference in New Issue
Block a user