Skip to content

Instantly share code, notes, and snippets.

@quii
Created February 14, 2020 11:29
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 quii/64c819c49393901eb224467cd2cc82e6 to your computer and use it in GitHub Desktop.
Save quii/64c819c49393901eb224467cd2cc82e6 to your computer and use it in GitHub Desktop.
stitcher
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