@@ -8,7 +8,7 @@ use crate::server::messages::Message;
8
8
use crate :: server:: { Data , GithubData , HttpError } ;
9
9
use crossbeam_channel:: Sender ;
10
10
use failure:: Compat ;
11
- use http:: { Response , StatusCode } ;
11
+ use http:: Response ;
12
12
use hyper:: Body ;
13
13
use std:: collections:: HashMap ;
14
14
use std:: sync:: { Arc , Condvar , Mutex } ;
@@ -32,46 +32,46 @@ pub fn routes(
32
32
let mutex_filter = warp:: any ( ) . map ( move || mutex. clone ( ) ) ;
33
33
let github_data_filter = warp:: any ( ) . map ( move || github_data. clone ( ) ) ;
34
34
35
- let config = warp:: post2 ( )
35
+ let config = warp:: post ( )
36
36
. and ( warp:: path ( "config" ) )
37
37
. and ( warp:: path:: end ( ) )
38
38
. and ( warp:: body:: json ( ) )
39
39
. and ( data_filter. clone ( ) )
40
40
. and ( auth_filter ( data. clone ( ) , TokenType :: Agent ) )
41
41
. map ( endpoint_config) ;
42
42
43
- let next_experiment = warp:: post2 ( )
43
+ let next_experiment = warp:: post ( )
44
44
. and ( warp:: path ( "next-experiment" ) )
45
45
. and ( warp:: path:: end ( ) )
46
46
. and ( mutex_filter. clone ( ) )
47
47
. and ( github_data_filter)
48
48
. and ( auth_filter ( data. clone ( ) , TokenType :: Agent ) )
49
49
. map ( endpoint_next_experiment) ;
50
50
51
- let next_crate = warp:: post2 ( )
51
+ let next_crate = warp:: post ( )
52
52
. and ( warp:: path ( "next-crate" ) )
53
53
. and ( warp:: path:: end ( ) )
54
54
. and ( warp:: body:: json ( ) )
55
55
. and ( data_filter. clone ( ) )
56
56
. and ( auth_filter ( data. clone ( ) , TokenType :: Agent ) )
57
57
. map ( endpoint_next_crate) ;
58
58
59
- let record_progress = warp:: post2 ( )
59
+ let record_progress = warp:: post ( )
60
60
. and ( warp:: path ( "record-progress" ) )
61
61
. and ( warp:: path:: end ( ) )
62
62
. and ( warp:: body:: json ( ) )
63
63
. and ( data_filter. clone ( ) )
64
64
. and ( auth_filter ( data. clone ( ) , TokenType :: Agent ) )
65
65
. map ( endpoint_record_progress) ;
66
66
67
- let heartbeat = warp:: post2 ( )
67
+ let heartbeat = warp:: post ( )
68
68
. and ( warp:: path ( "heartbeat" ) )
69
69
. and ( warp:: path:: end ( ) )
70
70
. and ( data_filter)
71
71
. and ( auth_filter ( data. clone ( ) , TokenType :: Agent ) )
72
72
. map ( endpoint_heartbeat) ;
73
73
74
- let error = warp:: post2 ( )
74
+ let error = warp:: post ( )
75
75
. and ( warp:: path ( "error" ) )
76
76
. and ( warp:: path:: end ( ) )
77
77
. and ( warp:: body:: json ( ) )
@@ -355,10 +355,10 @@ fn handle_results(resp: Fallible<Response<Body>>) -> Response<Body> {
355
355
}
356
356
}
357
357
358
- fn handle_errors ( err : Rejection ) -> Result < Response < Body > , Rejection > {
359
- let error = if let Some ( compat) = err. find_cause :: < Compat < HttpError > > ( ) {
358
+ async fn handle_errors ( err : Rejection ) -> Result < Response < Body > , Rejection > {
359
+ let error = if let Some ( compat) = err. find :: < Compat < HttpError > > ( ) {
360
360
Some ( * compat. get_ref ( ) )
361
- } else if let StatusCode :: NOT_FOUND | StatusCode :: METHOD_NOT_ALLOWED = err. status ( ) {
361
+ } else if err. is_not_found ( ) {
362
362
Some ( HttpError :: NotFound )
363
363
} else {
364
364
None
0 commit comments