{"id":41992,"date":"2024-12-01T09:41:31","date_gmt":"2024-12-01T01:41:31","guid":{"rendered":"https:\/\/fwq.ai\/blog\/41992\/"},"modified":"2024-12-01T09:41:31","modified_gmt":"2024-12-01T01:41:31","slug":"http-http2gzipreader-%e4%b8%8e-io-readcloser-golang","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/41992\/","title":{"rendered":"*http.http2gzipReader \u4e0e io.ReadCloser Golang"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span>  <span>&gt;<\/span>  <span>&gt;<\/span>  <span>&gt;<\/span> <span>*http.http2gzipReader \u4e0e io.ReadCloser Golang<\/span><\/p>\n<h1>*http.http2gzipReader \u4e0e io.ReadCloser Golang<\/h1>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-22 09:39:25<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p><span style=\"font-size: 15px\">\u5b66\u4e60\u77e5\u8bc6\u8981\u5584\u4e8e\u601d\u8003\uff0c\u601d\u8003\uff0c\u518d\u601d\u8003\uff01\u4eca\u5929\u7c73\u4e91\u5c0f\u7f16\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a*http.http2gzipReader \u4e0e io.ReadCloser Golang\u300b<\/span>\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u5305\u542b<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6216\u51c6\u5907\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">Golang<\/span>\uff0c\u5c31\u90fd\u4e0d\u8981\u9519\u8fc7\u672c\u6587\u5566~\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff0c\u80fd\u5e2e\u52a9\u5230\u4f60\u5c31\u66f4\u597d\u4e86\uff01<\/span><\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u5728response.go\u7684\u6e90\u4ee3\u7801\u5b9a\u4e49\u4e2d\uff0c\u5b9a\u4e49\u4e86<code>io.readcloser<\/code>\u7c7b\u578b\u7684body\uff0c\u4f46\u662f\u5728\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u6253\u5370body\u7c7b\u578b\u65f6\uff0c\u5b83\u6253\u5370\u4e86<code>*http.http2gzipreader<\/code>\u3002\u5b83\u4eec\u90fd\u4e00\u6837\u5417\uff1f<\/p>\n<pre>package main\n\nimport (\n    \"fmt\"\n    \"net\/http\"\n)\n\nfunc main() {\n    \/\/any url\n    url := \"https:\/\/www.goal.com\/en-in\"\n    res, _ := http.Get(url)\n    body := res.Body\n    fmt.Printf(\"tpye is %T\", body)\n}\n\n<\/pre>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u4e0d\uff0c\u5b83\u4eec\u4e0d\u4e00\u6837\u3002<\/p>\n<p><code>io.ReadCloser<\/code> \u63a5\u53e3\u662f\u8bf7\u6c42\u6b63\u6587\u7684\u7c7b\u578b\uff0c\u4f46 <code>*http.http2gzipReader<\/code> \u662f\u5206\u914d\u7ed9\u8be5\u63a5\u53e3\u7684\u5177\u4f53\u7c7b\u578b\u3002\u4e5f\u5c31\u662f\u6211\u4eec\u6240\u8bf4\u7684\uff0c<code>*http.http2gzipReader<\/code>\u5b9e\u73b0\u4e86<code>io.ReadCloser<\/code>\u63a5\u53e3\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a*http.http2gzipReader \u4e0e io.ReadCloser Golang\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &gt; &gt; *http.http2gzipReader \u4e0e io.ReadCloser Golang *http.http2gzipReader \u4e0e io.ReadCloser Golang \u6765\u6e90\uff1astackoverflow 2024-04-22 09:39:25 0\u6d4f\u89c8 \u6536\u85cf \u5b66\u4e60\u77e5\u8bc6\u8981\u5584\u4e8e\u601d\u8003\uff0c\u601d\u8003\uff0c\u518d\u601d\u8003\uff01\u4eca\u5929\u7c73\u4e91\u5c0f\u7f16\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765\u300a*http.http2gzipReader \u4e0e io.ReadCloser Golang\u300b\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u5305\u542b\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6216\u51c6\u5907\u5b66\u4e60Golang\uff0c\u5c31\u90fd\u4e0d\u8981\u9519\u8fc7\u672c\u6587\u5566~\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff0c\u80fd\u5e2e\u52a9\u5230\u4f60\u5c31\u66f4\u597d\u4e86\uff01 \u95ee\u9898\u5185\u5bb9 \u5728response.go\u7684\u6e90\u4ee3\u7801\u5b9a\u4e49\u4e2d\uff0c\u5b9a\u4e49\u4e86io.readcloser\u7c7b\u578b\u7684body\uff0c\u4f46\u662f\u5728\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u6253\u5370body\u7c7b\u578b\u65f6\uff0c\u5b83\u6253\u5370\u4e86*http.http2gzipreader\u3002\u5b83\u4eec\u90fd\u4e00\u6837\u5417\uff1f package main import ( &#8220;fmt&#8221; &#8220;net\/http&#8221; ) func main() { \/\/any url url := &#8220;https:\/\/www.goal.com\/en-in&#8221; res, _ := http.Get(url) body := res.Body fmt.Printf(&#8220;tpye is %T&#8221;, body) } \u89e3\u51b3\u65b9\u6848 \u4e0d\uff0c\u5b83\u4eec\u4e0d\u4e00\u6837\u3002 io.ReadCloser \u63a5\u53e3\u662f\u8bf7\u6c42\u6b63\u6587\u7684\u7c7b\u578b\uff0c\u4f46 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-41992","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/41992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=41992"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/41992\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=41992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=41992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=41992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}