HTTP handler for a PUT of a _local document
()
| 867 | |
| 868 | // HTTP handler for a PUT of a _local document |
| 869 | func (h *handler) handlePutLocalDoc() error { |
| 870 | docid := h.PathVar("docid") |
| 871 | localDocID := db.LocalDocPrefix + docid |
| 872 | |
| 873 | body, err := h.readJSON() |
| 874 | if err != nil { |
| 875 | return err |
| 876 | } |
| 877 | |
| 878 | revid, isNewDoc, err := h.collection.PutSpecial(db.DocTypeLocal, docid, body) |
| 879 | if err != nil { |
| 880 | return err |
| 881 | } |
| 882 | |
| 883 | auditEventForDocumentUpsert(h.ctx(), localDocID, revid, isNewDoc) |
| 884 | |
| 885 | h.writeRawJSONStatus(http.StatusCreated, []byte(`{"id":`+base.ConvertToJSONString(localDocID)+`,"ok":true,"rev":"`+revid+`"}`)) |
| 886 | return nil |
| 887 | } |
| 888 | |
| 889 | func auditEventForDocumentUpsert(ctx context.Context, docid string, revid string, isNewDoc bool) { |
| 890 | auditEvent := base.AuditIDDocumentUpdate |
nothing calls this directly
no test coverage detected