What is http RoundTripper

agolangf · · 4322 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all, Can someone explain, what is http roundtripper? </p> <p>Thanks </p> <hr/>**评论:**<br/><br/>pierrrre: <pre><p><a href="http://golang.org/pkg/net/http/#RoundTripper" rel="nofollow">http://golang.org/pkg/net/http/#RoundTripper</a> It&#39;s like a low level http client.</p></pre>zero_coding: <pre><p>what can I do with a roundtripper?</p></pre>jewishobo: <pre><p>Here is a long video about using the roundtripper interface to make an HTTP/2 client. <a href="https://www.youtube.com/watch?v=yG-UaBJXZ80">https://www.youtube.com/watch?v=yG-UaBJXZ80</a></p></pre>comrade_donkey: <pre><p>Take a look at http.Transport</p></pre>drvd: <pre><p>It is an interface, so all you can do is invoke its single method RoundTrip and I think the documentation is pretty clear.</p></pre>kodemizer: <pre><p>For http clients, it&#39;s behaviour can be configured using different RoundTripper implementations. By default, an http client will use an appropriately configured Transport struct (which satisfies a RoundTripper). </p> <p>By default, the Transport struct is configured to re-use network connections from a pool, timeout after a certain amount of time, use a certain proxy service etc.</p> <p>If you wanted to modify the behavior of your http client you have two options:</p> <ol> <li><p>Use the pre-existing Transport struct and configure appropriately. </p></li> <li><p>Write your very own implementation. As long as it satisfies RoupTripper, it can be used. You could do something creative like implement http over SSH, or some other crazy madness. </p></li> </ol></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

4322 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传