File tree 1 file changed +17
-18
lines changed
1 file changed +17
-18
lines changed Original file line number Diff line number Diff line change 1
1
//! Endpoint for triggering a docs.rs rebuild
2
2
3
- use super :: update:: authenticate;
4
3
use super :: CrateVersionPath ;
4
+ use super :: update:: authenticate;
5
5
use crate :: app:: AppState ;
6
- use crate :: controllers:: helpers:: ok_true;
7
6
use crate :: rate_limiter:: LimitedAction ;
8
- use crate :: util:: errors:: { forbidden, AppResult } ;
7
+ use crate :: util:: HeaderMapExt ;
8
+ use crate :: util:: errors:: { AppResult , forbidden} ;
9
+ use axum:: body:: Body ;
9
10
use axum:: response:: Response ;
11
+ use http:: HeaderValue ;
10
12
use http:: request:: Parts ;
11
13
12
14
/// Trigger a rebuild for the crate documentation on docs.rs.
@@ -52,20 +54,17 @@ pub async fn rebuild_version_docs(
52
54
. send ( )
53
55
. await ?;
54
56
55
- let status= = response. status ( ) ;
56
-
57
- // reqwest::
58
-
59
- // perform_version_yank_update(
60
- // &state,
61
- // &mut conn,
62
- // &mut version,
63
- // &krate,
64
- // &auth,
65
- // Some(yanked),
66
- // None,
67
- // )
68
- // .await?;
57
+ const APPLICATION_JSON : HeaderValue = HeaderValue :: from_static ( "application/json" ) ;
69
58
70
- ok_true ( )
59
+ Ok ( Response :: builder ( )
60
+ . status ( response. status ( ) )
61
+ . header (
62
+ "content-type" ,
63
+ response
64
+ . headers ( )
65
+ . get ( "content-type" )
66
+ . unwrap_or ( & APPLICATION_JSON ) ,
67
+ )
68
+ . body ( Body :: from_stream ( response. bytes_stream ( ) ) )
69
+ . unwrap ( ) )
71
70
}
You can’t perform that action at this time.
0 commit comments