ufront / ufront-mvc

The core MVC framework that powers ufront
MIT License
17 stars 15 forks source link

NodeJS target, context request params is null #68

Open varadig opened 6 years ago

varadig commented 6 years ago

I create a middleware for get admin token

public function requestIn(context:HttpContext):Surprise<Noise, Error> {
            var token = context.request.params[Tokens.ADMIN_TOKEN];
            trace(token); // null
            trace(context.request.params); // []

        return SurpriseTools.success();
}

Tokens.hx:

package model;
class Tokens {
    public static inline var ACCESS_TOKEN:String = 'access_token';
    public static inline var ADMIN_TOKEN:String = 'admin_token';
}

I have the cookie, after login:

var token = JsonWebToken.sign({username: admin.email, password:admin.password}, SECRET,{});
context.response.setCookie(new HttpCookie(Tokens.ADMIN_TOKEN, token, Date.fromTime(Date.now().getTime() + 20 * 60 * 1000), null, "/",false,true));

screenshot

varadig commented 6 years ago

Tested on PHP is working. I don't understand, because I used ufront a half years ago, with nodejs target and the cookie reading is worked there.