refactored to handle edge cases with bad requests and handle security modes server side
refactored to handle edge cases with bad requests and handle security modes server side

droplit/droplit.io-edge,droplit/droplit.io-edge,droplit/droplit.io-edge