MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / validateAPIDocUpdate

Function validateAPIDocUpdate

db/validation.go:43–50  ·  view source on GitHub ↗

validateAPIDocUpdate finds disallowed document properties that are allowed in through blip and/or import but not through the REST API

(body Body)

Source from the content-addressed store, hash-verified

41// validateAPIDocUpdate finds disallowed document properties that are allowed in through blip and/or import but not through
42// the REST API
43func validateAPIDocUpdate(body Body) error {
44 // VaLidation for disallowed properties for blip and import should be done in validateNewBody
45 // _rev, _attachments, _id are validated before reaching this function (due to endpoint specific behaviour)
46 if _, ok := body[base.SyncPropertyName]; ok {
47 return base.HTTPErrorf(http.StatusBadRequest, "document-top level property '_sync' is a reserved internal property")
48 }
49 return nil
50}
51
52// validateImportBody validates incoming import bodies
53func validateImportBody(body Body) error {

Callers 3

PutMethod · 0.85
CreateDocNoHLVMethod · 0.85

Calls 1

HTTPErrorfFunction · 0.92

Tested by

no test coverage detected