// sizeStackHandler returns the size of the Stack. func (c *Conn) sizeStackHandler(w http.ResponseWriter, r *http.Request, stack *pila.Stack) { stack.Read(c.opDate) log.Println(r.Method, r.URL, http.StatusOK, stack.Size()) w.Header().Set("Content-Type", "application/json") // Do not check error as we consider the size // of a stack valid for a JSON encoding. w.Write(stack.SizeToJSON()) }