@@ -33,6 +33,20 @@ defmodule ComponentsGuideWeb.LatencyComparisonLive do
3333 def get_fastest_slowest_responses ( % __MODULE__ { responses: responses } ) do
3434 Enum . min_max_by ( responses , fn response -> response . timings . duration end )
3535 end
36+
37+ def get_headers_of_interest ( % Fetch.Response { } = response ) do
38+ h = response . headers
39+ content_length = Enum . find ( h , fn { key , _ } -> String . downcase ( key ) == "content-length" end )
40+ content_encoding = Enum . find ( h , fn { key , _ } -> String . downcase ( key ) == "content_encoding" end )
41+ transfer_encoding = Enum . find ( h , fn { key , _ } -> String . downcase ( key ) == "transfer-encoding" end )
42+ cache_control = Enum . find ( h , fn { key , _ } -> String . downcase ( key ) == "cache-control" end )
43+ inspect ( [
44+ content_length ,
45+ content_encoding ,
46+ transfer_encoding ,
47+ cache_control
48+ ] )
49+ end
3650 end
3751
3852 @ impl true
@@ -53,7 +67,7 @@ defmodule ComponentsGuideWeb.LatencyComparisonLive do
5367 < output form = "latency_comparison_form " class = "flex flex-col gap-4 pt-4 max-w-none text-center " >
5468 <%= for response <- @ state . responses || [ ] , response != nil do %>
5569 < div class = "p-4 text-white bg-black font-mono " >
56- < pre class = "bg-transparent " > <%= response . url %> </ pre >
70+ < pre class = "bg-transparent " title = { State . get_headers_of_interest ( response ) } > <%= response . url %> </ pre >
5771 < div class = "my-1 flex justify-center " >
5872 < div class = "h-1 bg-yellow-200 " style = { "width: #{ System . convert_time_unit ( response . timings . connected , :native , :millisecond ) } px" } > </ div >
5973 < div class = "h-1 bg-green-500 " style = { "width: #{ System . convert_time_unit ( response . timings . received_status - response . timings . connected , :native , :millisecond ) } px" } > </ div >
@@ -146,6 +160,8 @@ defmodule ComponentsGuideWeb.LatencyComparisonLive do
146160 "https://blog.cloudflare.com/rss/" ,
147161 "https://vercel.com/blog" ,
148162 "https://vercel.com/atom" ,
163+ "https://tailwindcss.com/blog" ,
164+ "https://tailwindcss.com/feeds/atom.xml" ,
149165 "https://fly.io/blog" ,
150166 "https://fly.io/blog/feed.xml" ,
151167 "https://render.com/blog" ,
0 commit comments