summaryrefslogtreecommitdiffstats
path: root/src/routes.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-13 04:51:19 +0300
committerYigit Sever2021-04-13 04:51:19 +0300
commit8b50bf2e66f02e64e7fbec8079094bafb5ccdc6a (patch)
tree615f6254a326077f83aa5200c822bceb823696e0 /src/routes.rs
parent0158bc39981a751d53e2d12633d179d22484c791 (diff)
downloadgradecoin-8b50bf2e66f02e64e7fbec8079094bafb5ccdc6a.tar.gz
gradecoin-8b50bf2e66f02e64e7fbec8079094bafb5ccdc6a.tar.bz2
gradecoin-8b50bf2e66f02e64e7fbec8079094bafb5ccdc6a.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.rs7
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
55pub fn block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { 55pub 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