DimaCrafter / dc-api-core

Simple API core for your projects
MIT License
11 stars 5 forks source link

Code execution after onLoad exit #16

Closed car1ot closed 4 years ago

car1ot commented 4 years ago

The code executed after exiting onLoad().

module.exports = class User {
    /* got a request => */
    onLoad() {
        if (!this.session.user) {
            /* no user session found, returning false and request ended with 403 error => */
            this.send('Forbidden', 403);
            return false;
        }
    }

    async someAction() {
        /* !!! code here is still executing => */
    }
}

Expected finishing request controller methods EXECUTION after returning false inside onLoad()

DimaCrafter commented 4 years ago

onLoad returns isDropRequest value, you should to return true to stop request dispatching.