code: func (r *successResponse) write(w http.ResponseWriter, err error) {
  	// Apply the error and get the status code.
  	statusCode := r.check(err)
  
  	// Marshal the json response.
  	msg, err := json.Marshal(r)
  	if err != nil {
  		http.Error(w, string(msg), http.StatusInternalServerError)
  		return
  	}
  
  	// Write the response.
  	if statusCode == 0 {
  		_, err := w.Write(msg)
  		if err != nil {
  			r.h.logger.Printf("error writing response: %v", err)
  			http.Error(w, string(msg), http.StatusInternalServerError)
  			return
  		}
  		_, err = w.Write([]byte("\n"))
  		if err != nil {
  			r.h.logger.Printf("error writing newline after response: %v", err)
  			http.Error(w, string(msg), http.StatusInternalServerError)
  			return
  		}
  	} else {
  		http.Error(w, string(msg), statusCode)
  	}
  }
docs: // write sends a response to the http.ResponseWriter based on the success
  // status and the error.