<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>daisuzu</author_name>
  <author_url>https://blog.hatena.ne.jp/daisuzu/</author_url>
  <blog_title>daisuzu's notes</blog_title>
  <blog_url>https://daisuzu.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
  </categories>
  <description>Goで外部リクエストが関わる処理をテストする - Qiita のfetch(url string)と違って引数でURLを取れないような関数をテストする場合、 http.DefaultTransport.(*http.Transport).Proxyを書き換えるとテストサーバにリクエストを飛ばせる。 main.go package main import ( &quot;fmt&quot; &quot;io/ioutil&quot; &quot;log&quot; &quot;net/http&quot; ) func fetch() []byte { res, err := http.Get(&quot;http://localhost:8000/test&quot;) if err != …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdaisuzu.hatenablog.com%2Fentry%2F2015%2F06%2F30%2F223407&quot; title=&quot;Goでhttp.ClientのテストをするときにProxyを書き換えてテストサーバにリクエストを投げる - daisuzu&amp;#39;s notes&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2015-06-30 22:34:07</published>
  <title>Goでhttp.ClientのテストをするときにProxyを書き換えてテストサーバにリクエストを投げる</title>
  <type>rich</type>
  <url>https://daisuzu.hatenablog.com/entry/2015/06/30/223407</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
