Created
February 14, 2020 11:29
-
-
Save quii/64c819c49393901eb224467cd2cc82e6 to your computer and use it in GitHub Desktop.
stitcher
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 Stitcher(w http.ResponseWriter, r *http.Request) { | |
urls := r.URL.Query()["url"] | |
if len(urls) == 0 { | |
http.Error(w, "please provide a url querystring value", http.StatusBadRequest) | |
return | |
} | |
for _, url := range urls { | |
res, _ := http.Get(url) | |
defer res.Body.Close() | |
io.Copy(w, res.Body) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment