Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
update avatar_url in response object (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sameer Naik authored and prydonius committed Nov 16, 2017
1 parent ba332f0 commit 31b9193
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ func CreateComment(w http.ResponseWriter, req *http.Request) {
return
}
}

// update avatar_url in response object
h := md5.New()
io.WriteString(h, cm.Author.Email)
cm.Author.AvatarUrl = fmt.Sprintf("https://s.gravatar.com/avatar/%x", h.Sum(nil))

response.NewDataResponse(cm).WithCode(http.StatusCreated).Write(w)
}

Expand Down

0 comments on commit 31b9193

Please sign in to comment.