<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kmtr</author_name>
  <author_url>https://blog.hatena.ne.jp/kmtr/</author_url>
  <blog_title>kmtrの日記</blog_title>
  <blog_url>https://kmtr.hateblo.jp/</blog_url>
  <categories>
  </categories>
  <description>はじめに 外部のWebサービスから、HTTP(HTTPS)で情報を取得し、その結果を利用するというのはよく行われます。 Goの標準パッケージにはHTTPクライアントが含まれているため、その処理自体を書くのは簡単です。 しかしこれのテストを行うとなると少し難しくなります。 この記事ではHacker News API(https://github.com/HackerNews/API)を例として、どのようにHTTP呼び出しのテストを書くのか紹介します。 HTTP呼び出しの例 Hacker News APIのうち、トップストーリーのID一覧を取得するAPIを呼び出す関数を書いてみます。 このトップス…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkmtr.hateblo.jp%2Fentry%2F2018%2F05%2F05%2F105043&quot; title=&quot;GoによるHTTP呼び出しのユニットテスト - kmtrの日記&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>2018-05-05 10:50:43</published>
  <title>GoによるHTTP呼び出しのユニットテスト</title>
  <type>rich</type>
  <url>https://kmtr.hateblo.jp/entry/2018/05/05/105043</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
