<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rennnosukesann</author_name>
  <author_url>https://blog.hatena.ne.jp/rennnosukesann/</author_url>
  <blog_title>Ren's blog</blog_title>
  <blog_url>https://rennnosukesann.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
  </categories>
  <description>Goal Go の http.RoundTripper を使用して、http.Client パッケージのリクエストの前処理・後処理を追加できるようにしてみます。 Background HTTPクライアントを利用した実装において、リクエストやレスポンスに関連した処理を書きたいことはよくあります。 リクエスト時にログやトレースを仕込みたい メソッドやendpointごとにRate Limitを設けたい 特定のステータスコードに対してリトライしたい このような場合、 http.Client が持つ Transport フィールドを書き換え、リクエスト時に処理を実行してもらうことができます。 http…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frennnosukesann.hatenablog.com%2Fentry%2F2024%2F08%2F03%2F162216&quot; title=&quot;Go HTTPクライアントの前処理・後処理を `RoundTripper` で実装する - Ren&amp;#39;s blog&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>2024-08-03 16:22:16</published>
  <title>Go HTTPクライアントの前処理・後処理を `RoundTripper` で実装する</title>
  <type>rich</type>
  <url>https://rennnosukesann.hatenablog.com/entry/2024/08/03/162216</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
