typeClientstruct{//Transportspecifiesthemechanismbywhichindividual//HTTPrequestsaremade.//Ifnil,DefaultTransportisused.TransportRoundTripper//CheckRedirectspecifiesthepolicyforhandlingredirects.//IfCheckRedirectisnotnil,theclientcallsitbefore//followinganHTTPredirect.Theargumentsreqandviaare//theupcomingrequestandtherequestsmadealready,oldest//first.IfCheckRedirectreturnsanerror,theClient'sGet//methodreturnsboththepreviousResponseand//CheckRedirect'serror(wrappedinaurl.Error)insteadof//issuingtheRequestreq.////IfCheckRedirectisnil,theClientusesitsdefaultpolicy,//whichistostopafter10consecutiverequests.CheckRedirectfunc(req*Request,via[]*Request)error//Jarspecifiesthecookiejar.//IfJarisnil,cookiesarenotsentinrequestsandignored//inresponses.JarCookieJar//Timeoutspecifiesatimelimitforrequestsmadebythis//Client.Thetimeoutincludesconnectiontime,any//redirects,andreadingtheresponsebody.Thetimerremains//runningafterGet,Head,Post,orDoreturnandwill//interruptreadingoftheResponse.Body.////ATimeoutofzeromeansnotimeout.////TheClient'sTransportmustsupporttheCancelRequest//methodorClientwillreturnerrorswhenattemptingtomake//arequestwithGet,Head,Post,orDo.Client'sdefault//Transport(DefaultTransport)supportsCancelRequest.Timeouttime.Duration}以上是部分源码。之前有同学问,client的timeout存在问题,请问有其他人遇见了同样的问题么?
富国沪深
相关分类