<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ema_hiro</author_name>
  <author_url>https://blog.hatena.ne.jp/ema_hiro/</author_url>
  <blog_title>emahiro/b.log</blog_title>
  <blog_url>https://ema-hiro.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
  </categories>
  <description>Overview どういうケースか？ 結論: Clone してから Body に詰め直す まとめ Overview Go の http.Request を二度読み込みしたいケースでハマったのでその備忘録です。 どういうケースか？ API を書いていると認証・認可等のAPI全体に関わる共通の前処理を middleware で行い、ユースケースの処理を後続で行うというパターンがよくあると思います。 この際、大体のケースはリクエストヘッダーの情報のみで処理を行い、Body 本体に触ることは少ないかと思いますが、Body の中の情報も認証に利用するケース(*1) に遭遇したときに、前処理で Reque…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fema-hiro.hatenablog.com%2Fentry%2F2023%2F07%2F19%2F014325&quot; title=&quot;http.Request をコピーする - emahiro/b.log&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>2023-07-19 01:43:25</published>
  <title>http.Request をコピーする</title>
  <type>rich</type>
  <url>https://ema-hiro.hatenablog.com/entry/2023/07/19/014325</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
