<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yoppy0066</author_name>
  <author_url>https://blog.hatena.ne.jp/yoppy0066/</author_url>
  <blog_title>とりあえずphpとか</blog_title>
  <blog_url>https://kimagureneet.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
    <anon>Echo</anon>
  </categories>
  <description>Echoを使っていてデフォルトのままで存在しないURLにアクセスするとNotFoundのJSONがレスポンスとして返される。 今回はAPIでなくてサイトを作りたかったのでHTMLを返したかった。ちょっとやり方がわからなかったので今回は以下のように対応した。Echoで定義されているHTTPErrorHandlerを上書きすることでハンドリングできたのでここでHTTPステータスをみてテンプレートを切り替えるように対応してみたserver.go package main import ( &quot;io&quot; &quot;strconv&quot; &quot;errors&quot; &quot;net/http&quot; &quot;html/template&quot; &quot;gith…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkimagureneet.hatenablog.com%2Fentry%2F2017%2F01%2F12%2F212721&quot; title=&quot;【Go】Echoで404ページと500ページを表示 - とりあえずphpとか&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>2017-01-12 21:27:21</published>
  <title>【Go】Echoで404ページと500ページを表示</title>
  <type>rich</type>
  <url>https://kimagureneet.hatenablog.com/entry/2017/01/12/212721</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
