(w http.ResponseWriter, r *http.Request)
| 563 | } |
| 564 | |
| 565 | func (s *Server) writeNote(w http.ResponseWriter, r *http.Request) { |
| 566 | cfg := s.currentConfig() |
| 567 | r.Body = http.MaxBytesReader(w, r.Body, cfg.MaxNoteBytes+jsonEnvelopeBytes) |
| 568 | var req struct { |
| 569 | Path string `json:"path"` |
| 570 | Body string `json:"body"` |
| 571 | } |
| 572 | if err := readJSON(r, &req); err != nil { |
| 573 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 574 | return |
| 575 | } |
| 576 | meta, err := s.currentVault().WriteNote(req.Path, req.Body) |
| 577 | if err != nil { |
| 578 | writeError(w, err) |
| 579 | return |
| 580 | } |
| 581 | writeJSON(w, http.StatusOK, meta) |
| 582 | } |
| 583 | |
| 584 | func (s *Server) createNote(w http.ResponseWriter, r *http.Request) { |
| 585 | var req struct { |
nothing calls this directly
no test coverage detected