@@ -25,16 +25,16 @@ pub fn simulate_routes(
25
25
) -> impl Filter < Extract = ( impl Reply , ) , Error = Rejection > + Clone {
26
26
simulate ( config. clone ( ) )
27
27
. or ( simulate_bundle ( config. clone ( ) ) )
28
- . or ( simulate_stateful_new ( config, state. clone ( ) ) )
28
+ . or ( simulate_stateful_new ( config. clone ( ) , state. clone ( ) ) )
29
29
. or ( simulate_stateful_end ( state. clone ( ) ) )
30
- . or ( simulate_stateful ( state) )
30
+ . or ( simulate_stateful ( config , state) )
31
31
}
32
32
33
33
/// POST /simulate
34
34
pub fn simulate ( config : Config ) -> impl Filter < Extract = ( impl Reply , ) , Error = Rejection > + Clone {
35
35
warp:: path!( "simulate" )
36
36
. and ( warp:: post ( ) )
37
- . and ( json_body :: < SimulationRequest > ( ) )
37
+ . and ( json_body :: < SimulationRequest > ( & config ) )
38
38
. and ( with_config ( config) )
39
39
. and_then ( simulation:: simulate)
40
40
}
@@ -45,7 +45,7 @@ pub fn simulate_bundle(
45
45
) -> impl Filter < Extract = ( impl Reply , ) , Error = Rejection > + Clone {
46
46
warp:: path!( "simulate-bundle" )
47
47
. and ( warp:: post ( ) )
48
- . and ( json_body ( ) )
48
+ . and ( json_body ( & config ) )
49
49
. and ( with_config ( config) )
50
50
. and_then ( simulation:: simulate_bundle)
51
51
}
@@ -57,7 +57,7 @@ pub fn simulate_stateful_new(
57
57
) -> impl Filter < Extract = ( impl Reply , ) , Error = Rejection > + Clone {
58
58
warp:: path!( "simulate-stateful" )
59
59
. and ( warp:: post ( ) )
60
- . and ( json_body :: < StatefulSimulationRequest > ( ) )
60
+ . and ( json_body :: < StatefulSimulationRequest > ( & config ) )
61
61
. and ( with_config ( config) )
62
62
. and ( with_state ( state) )
63
63
. and_then ( simulation:: simulate_stateful_new)
@@ -75,11 +75,12 @@ pub fn simulate_stateful_end(
75
75
76
76
/// POST /simulate-stateful/{statefulSimulationId}
77
77
pub fn simulate_stateful (
78
+ config : Config ,
78
79
state : Arc < SharedSimulationState > ,
79
80
) -> impl Filter < Extract = ( impl Reply , ) , Error = Rejection > + Clone {
80
81
warp:: path!( "simulate-stateful" / Uuid )
81
82
. and ( warp:: post ( ) )
82
- . and ( json_body ( ) )
83
+ . and ( json_body ( & config ) )
83
84
. and ( with_state ( state) )
84
85
. and_then ( simulation:: simulate_stateful)
85
86
}
@@ -97,7 +98,8 @@ fn with_state(
97
98
warp:: any ( ) . map ( move || state. clone ( ) )
98
99
}
99
100
100
- fn json_body < T : DeserializeOwned + Send > ( ) -> impl Filter < Extract = ( T , ) , Error = Rejection > + Clone
101
- {
102
- warp:: body:: content_length_limit ( 1024 * 16 ) . and ( warp:: body:: json ( ) )
101
+ fn json_body < T : DeserializeOwned + Send > (
102
+ config : & Config ,
103
+ ) -> impl Filter < Extract = ( T , ) , Error = Rejection > + Clone {
104
+ warp:: body:: content_length_limit ( config. max_request_size ) . and ( warp:: body:: json ( ) )
103
105
}
0 commit comments