diff options
author | Yigit Sever | 2021-04-13 04:51:19 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-13 04:51:19 +0300 |
commit | 116af4059f43eb3986b54fee080af9f67c247472 (patch) | |
tree | 387c03347f7d72fe949861518cfc606759b4c4a2 /src/routes.rs | |
parent | 14b6904f00a17d3d6757a7e5222df966aa37fa35 (diff) | |
download | gradecoin-116af4059f43eb3986b54fee080af9f67c247472.tar.gz gradecoin-116af4059f43eb3986b54fee080af9f67c247472.tar.bz2 gradecoin-116af4059f43eb3986b54fee080af9f67c247472.zip |
Require authorization for Block POST
Not tested because it's impossible to follow without verbose error
messages, failing 1 test
Diffstat (limited to 'src/routes.rs')
-rw-r--r-- | src/routes.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/routes.rs b/src/routes.rs index e4bdee4..0fb61c4 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -10,7 +10,7 @@ pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rej | |||
10 | transaction_list(db.clone()) | 10 | transaction_list(db.clone()) |
11 | .or(register_user(db.clone())) | 11 | .or(register_user(db.clone())) |
12 | .or(auth_transaction_propose(db.clone())) | 12 | .or(auth_transaction_propose(db.clone())) |
13 | .or(block_propose(db.clone())) | 13 | .or(auth_block_propose(db.clone())) |
14 | .or(block_list(db.clone())) | 14 | .or(block_list(db.clone())) |
15 | } | 15 | } |
16 | 16 | ||
@@ -52,11 +52,12 @@ pub fn auth_transaction_propose( | |||
52 | } | 52 | } |
53 | 53 | ||
54 | /// POST /block warp route | 54 | /// POST /block warp route |
55 | pub fn block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { | 55 | pub fn auth_block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { |
56 | warp::path!("block") | 56 | warp::path!("block") |
57 | .and(warp::post()) | 57 | .and(warp::post()) |
58 | .and(custom_filters::block_json_body()) | 58 | .and(custom_filters::block_json_body()) |
59 | .and(custom_filters::auth_header()) | ||
59 | .and(custom_filters::with_db(db)) | 60 | .and(custom_filters::with_db(db)) |
60 | .and_then(handlers::propose_block) | 61 | .and_then(handlers::auth_propose_block) |
61 | } | 62 | } |
62 | 63 | ||