Skip to content

Instantly share code, notes, and snippets.

@johnwesonga
Last active July 24, 2025 22:24
Show Gist options
  • Select an option

  • Save johnwesonga/79703e5011e7c7cf300832e9e457ac3b to your computer and use it in GitHub Desktop.

Select an option

Save johnwesonga/79703e5011e7c7cf300832e9e457ac3b to your computer and use it in GitHub Desktop.
Get specific header for HTTPoison
{_, server} = "https://api.github.com"
|> HTTPoison.get!
|> Map.get(:headers)
|> Enum.filter(&match?({"Server", _}, &1))
|> List.first
{_, server} = "https://api.github.com"
|> HTTPoison.get!
|> Map.get(:headers)
|> List.keyfind("Server", 0)
server = "https://api.github.com" |> Req.get! |> Map.get(:headers) |> Kernel.get_in(["server"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment