@@ -245,8 +245,10 @@ use std::{
245245 task:: { Context , Poll } ,
246246} ;
247247
248- use axum:: http:: { self , HeaderValue , Request , StatusCode } ;
249- use axum_core:: response:: { IntoResponse , Response } ;
248+ use axum:: {
249+ http:: { self , HeaderValue , Request , StatusCode } ,
250+ response:: { IntoResponse , Response } ,
251+ } ;
250252use tower_sessions:: Session ;
251253use base64:: prelude:: * ;
252254use rand:: RngCore ;
@@ -545,8 +547,15 @@ where
545547mod tests {
546548 use std:: convert:: Infallible ;
547549
548- use axum:: { body:: Body , routing:: get, Router , error_handling:: HandleErrorLayer } ;
549- use axum_core:: { response:: { IntoResponse , Response } , BoxError } ;
550+ use axum:: {
551+ body:: Body ,
552+ routing:: get,
553+ Router ,
554+ error_handling:: HandleErrorLayer ,
555+ response:: { IntoResponse , Response } ,
556+ BoxError ,
557+ } ;
558+
550559 use tower_sessions:: { MemoryStore , SessionManagerLayer } ;
551560 use http:: {
552561 header:: { COOKIE , SET_COOKIE } ,
@@ -571,12 +580,12 @@ mod tests {
571580 fn app ( csrf_layer : CsrfLayer ) -> Router {
572581 Router :: new ( )
573582 . route ( "/" , get ( handler) . post ( handler) )
574- . layer ( csrf_layer)
575583 . layer ( ServiceBuilder :: new ( )
576584 . layer ( HandleErrorLayer :: new ( |_: BoxError | async {
577585 StatusCode :: BAD_REQUEST
578586 } ) )
579587 . layer ( session_layer ( ) ) )
588+ . layer ( CsrfMiddleware :: new ( csrf_layer) )
580589 }
581590
582591 #[ tokio:: test]
0 commit comments