MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / writeNote

Method writeNote

apps/server/internal/httpserver/server.go:565–582  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

563}
564
565func (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
584func (s *Server) createNote(w http.ResponseWriter, r *http.Request) {
585 var req struct {

Callers

nothing calls this directly

Calls 7

currentConfigMethod · 0.95
currentVaultMethod · 0.95
readJSONFunction · 0.85
writeErrorFunction · 0.85
writeJSONFunction · 0.85
ErrorMethod · 0.80
WriteNoteMethod · 0.80

Tested by

no test coverage detected