Last active
December 11, 2015 21:38
-
-
Save tamasd/4663387 to your computer and use it in GitHub Desktop.
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 getNode(nid string, cookie *http.Cookie) (title String, body BodyField) { | |
resp := get("node/" + nid, cookie) | |
rawbody := getBody(resp) | |
var node Node | |
if err := json.Unmarshal(rawbody, &node); err != nil { | |
log.Fatal(err) | |
} | |
if len(node.Body[node.Language]) > 0 { | |
return node.Title, node.Body[node.Language][0] | |
} | |
return node.Title, "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment