报错原因:goproxy.ProxyHttpServer 类型没有 NewRequest 方法。

解决方法:使用 goproxy.Request 类型的 New 方法创建请求对象。

修改代码:

_, err := goproxy.NewProxyHttpServer().Tr.RoundTrip(goproxy.NewProxyHttpServer().NewRequest("GET", apiUrl, nil))

修改为

req := goproxy.NewRequest(ctx.Req.Method, apiUrl, nil) _, err := goproxy.NewProxyHttpServer().Tr.RoundTrip(req)


原文地址: https://www.cveoy.top/t/topic/eDrW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录