Skip to content

Commit d76f034

Browse files
committed
Add tailwind blog, show headers of interest
1 parent f129095 commit d76f034

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/components_guide_web/live/latency_comparison.ex

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)