Created
March 5, 2020 01:57
-
-
Save v0lkan/0f8b44d1d88fd6e4b6daa5e25a8c7f1c to your computer and use it in GitHub Desktop.
to-akamai.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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