Created
March 20, 2015 10:31
-
-
Save quii/09838e2813d0c391f5dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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