Skip to content

Instantly share code, notes, and snippets.

@tamasd
Last active December 11, 2015 21:38
Show Gist options
  • Save tamasd/4663387 to your computer and use it in GitHub Desktop.
Save tamasd/4663387 to your computer and use it in GitHub Desktop.
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