(docid, revOrCV string)
| 211 | } |
| 212 | |
| 213 | func (h *handler) handleGetDocReplicator2(docid, revOrCV string) error { |
| 214 | if !base.IsEnterpriseEdition() { |
| 215 | return base.HTTPErrorf(http.StatusNotImplemented, "replicator2 endpoints are only supported in EE") |
| 216 | } |
| 217 | |
| 218 | rev, err := h.collection.GetRev(h.ctx(), docid, revOrCV, true, nil) |
| 219 | if err != nil { |
| 220 | return err |
| 221 | } |
| 222 | |
| 223 | // Stamp _attachments into message to match BLIP sendRevision behaviour |
| 224 | bodyBytes := rev.BodyBytes |
| 225 | if len(rev.Attachments) > 0 { |
| 226 | bodyBytes, err = base.InjectJSONProperties(bodyBytes, base.KVPair{Key: db.BodyAttachments, Val: rev.Attachments}) |
| 227 | if err != nil { |
| 228 | return err |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | h.setHeader("Content-Type", "application/json") |
| 233 | _, _ = h.response.Write(bodyBytes) |
| 234 | h.db.DbStats.Database().NumDocReadsRest.Add(1) |
| 235 | base.Audit(h.ctx(), base.AuditIDDocumentRead, base.AuditFields{ |
| 236 | base.AuditFieldDocID: docid, |
| 237 | base.AuditFieldDocVersion: rev.RevID, |
| 238 | }) |
| 239 | return nil |
| 240 | } |
| 241 | |
| 242 | // HTTP handler for a GET of a specific doc attachment |
| 243 | func (h *handler) handleGetAttachment() error { |
no test coverage detected