diff options
author | Yigit Sever | 2021-04-13 04:51:19 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-13 04:51:19 +0300 |
commit | 8b50bf2e66f02e64e7fbec8079094bafb5ccdc6a (patch) | |
tree | 615f6254a326077f83aa5200c822bceb823696e0 /src/routes.rs | |
parent | 0158bc39981a751d53e2d12633d179d22484c791 (diff) | |
download | gradecoin-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.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 | ||