Skip to content

Instantly share code, notes, and snippets.

@quii
Created March 20, 2015 10:31
Show Gist options
  • Save quii/09838e2813d0c391f5dc to your computer and use it in GitHub Desktop.
Save quii/09838e2813d0c391f5dc to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
// Stitcher calls the Hello and World APIs to create a very useful string
func Stitcher(helloURL string, worldURL string) string {
helloResponse, _ := http.Get(helloURL)
defer helloResponse.Body.Close()
helloContent, _ := ioutil.ReadAll(helloResponse.Body)
worldResponse, _ := http.Get(worldURL)
defer worldResponse.Body.Close()
worldContent, _ := ioutil.ReadAll(worldResponse.Body)
return string(helloContent) + ", " + string(worldContent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment