Changeset 499 for Dev/trunk/src/server/app.js
- Timestamp:
- 03/10/14 11:50:04 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/server/app.js
r497 r499 225 225 function putDocument(id,rev,type,doc) { 226 226 var priv = stripAndReturnPrivates(doc); 227 if ( doc.type === type && validator(doc, schema).valid ) { 227 var valid; 228 if ( doc.type === type && (valid = validator(doc, schema)).valid ) { 228 229 var opts = rev ? {headers:{'If-Match':'"'+rev+'"'}} : {}; 229 230 return HTTPResult.fromResponsePromise(couch.put(id,doc,opts).response, … … 241 242 }); 242 243 } else { 243 return new HTTPResult(400,{error: "Document failed schema verification." });244 return new HTTPResult(400,{error: "Document failed schema verification.", valid: valid}); 244 245 } 245 246 } … … 262 263 function postDocument(type,doc) { 263 264 var priv = stripAndReturnPrivates(doc); 264 if ( doc.type === type && validator(doc, schema).valid ) { 265 var valid; 266 if ( doc.type === type && (valid = validator(doc, schema)).valid ) { 265 267 return HTTPResult.fromResponsePromise(couch.post(doc).response, 266 268 handleUnknownError) … … 274 276 }); 275 277 } else { 276 return new HTTPResult(400,{error: "Document failed schema verification." });278 return new HTTPResult(400,{error: "Document failed schema verification.", valid: valid}); 277 279 } 278 280 }
Note: See TracChangeset
for help on using the changeset viewer.