// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
/**
@module azure-mobile-apps/src/express/middleware/checkReservedProperties
@description The checkReservedProperties middleware ensures that objects
with reserved properties are not presented to the REST API. These properties
are stripped out by the client SDK before transmitting to the server.
*/
var errors = require('../../utilities/errors'),
    reservedProperties = ['createdat', 'updatedat', 'deleted'];

/** The module directly exports an instance of the middleware */
module.exports = function (req, res, next) {
    var properties = Object.keys(req.azureMobile.item),
        propertyName;

    for(var i = 0, l = properties.length; i < l && !propertyName; i++)
        if(reservedProperties.indexOf(properties[i].toLowerCase()) > -1)
            propertyName = properties[i]

    if(propertyName)
        next(errors.badRequest("Cannot update item with property '" + propertyName + "' as it is reserved"));
    else
        next();
};

@@ -751,16 +751,96 @@
 ext) %7B%0D%0A
+    var item = req.azureMobile.item;%0D%0A%0D%0A    if(typeof item === %22object%22) %7B%0D%0A    
     var 
@@ -868,32 +868,16 @@
 eys(
-req.azureMobile.
 item),%0D%0A
     
@@ -868,24 +868,28 @@
 eys(item),%0D%0A
+    
         prop
@@ -897,24 +897,28 @@
 rtyName;%0D%0A%0D%0A
+    
     for(var 
@@ -985,16 +985,20 @@
         
+    
 if(reser
@@ -1059,32 +1059,36 @@
 1)%0D%0A            
+    
 propertyName = p
@@ -1107,16 +1107,20 @@
 %0D%0A%0D%0A    
+   
+ 
 if(prope
@@ -1129,16 +1129,20 @@
 yName)%0D%0A
+    
         
@@ -1244,16 +1244,20 @@
 ed%22));%0D%0A
+    
     else
@@ -1262,24 +1262,28 @@
 se%0D%0A        
+ 
+   
 next();%0D%0A%7D;%0D
@@ -1279,12 +1279,50 @@
 ext();%0D%0A
+    %7D else %7B%0D%0A        next();%0D%0A    %7D%0D%0A
 %7D;%0D%0A

Fix issue with checkReservedProperties in 0.10.x