Extracting HTTP Headers in Elm
There’s no standard way to extract HTTP response headers in Elm. Github API returns pagination info in link headers.
For parsing Link headers I found https://package.elm-lang.org/packages/jackfranklin/elm-parse-link-header which works pretty well. But how do I extract the headers from response? Turns out Elm `Http` has function `Http.expectStringResponse`that gives us the raw response and we can now extract our headers and body from it. It needs some ceremony before we can use it.
Here we get link header from resp.headers Dict then pass it to `LinkHeader.parse`.
Then we proceed to decoding resp.body, then merge the headers and repos with `Result.map`.
Full code is available at https://gist.github.com/girishso/6343a18af49a142d37b59bc92d61e09c