You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have noticed that only Json struct is able to generate resposne in final specification JSON. Unfortunately Json struct can not have cookies attached to it, so I need to use HttpResponse. I tried both actix_web::HttpResponse and paperclip::actix::web::HttpResponse. They don't generate anything. Here is what I am trying to achive:
#[api_v2_operation( description = "User authorization endpoint. Creates user session and returns auth cookies when credentials are correct", operation_id = "auth_handler", tags("Session", "Public API"))]#[post("/api/auth")]pubasyncfnauth(params:Json<AuthUserRequest>,data:Data<Pool<ConnectionManager<PgConnection>>>,session:Session,) -> actix_web::Result<HttpResponse>{
...let auth_cookie = actix_web::cookie::Cookie::build("user_uuid", found_user.uuid).secure(true).path("/").finish();Ok(HttpResponse::Ok().cookie(auth_cookie).json(Json(())))}
I have also similar issue with HttpRequest. Session cookies are atteched to it, but they are also not generated. Is there any way to generate them, even manually in api_v2_operation macro?
#[api_v2_operation( description = "User session verify endpoint. Returns OK when user session exists", operation_id = "session_verify_handler", tags("Session"))]#[get("/api/auth")]pubasyncfn session_verify(reqest:HttpRequest,session:Session) -> actix_web::Result<Json<()>>{ifUser::authorize(&reqest,&session).is_some(){returnOk(Json(()));}
cookies are in -> request.cookie("name")
Best regards,
Piotr Skorupa
The text was updated successfully, but these errors were encountered:
As far as I can recall, we walk through the types only once at the start and we can't infer anything useful from dynamic objects (like HttpResponse). Would be worth it to see how other packages are doing though.
Hi, I have noticed that only
Json
struct is able to generate resposne in final specification JSON. UnfortunatelyJson
struct can not have cookies attached to it, so I need to useHttpResponse
. I tried bothactix_web::HttpResponse
andpaperclip::actix::web::HttpResponse
. They don't generate anything. Here is what I am trying to achive:I have also similar issue with
HttpRequest
. Session cookies are atteched to it, but they are also not generated. Is there any way to generate them, even manually inapi_v2_operation
macro?cookies are in ->
request.cookie("name")
Best regards,
Piotr Skorupa
The text was updated successfully, but these errors were encountered: