Skip to content

Instantly share code, notes, and snippets.

@v0lkan
Created March 5, 2020 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v0lkan/0f8b44d1d88fd6e4b6daa5e25a8c7f1c to your computer and use it in GitHub Desktop.
Save v0lkan/0f8b44d1d88fd6e4b6daa5e25a8c7f1c to your computer and use it in GitHub Desktop.
to-akamai.go
func ToAkamai(url string) string {
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
}}
resp, err := client.Get(url)
if err != nil {
return ""
}
return resp.Header.Get("Location")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment