detailed request must come with a bearer token

This commit is contained in:
yenicelik 2023-05-24 13:34:50 +02:00
parent 59634139c9
commit 47f07261ed

@ -41,6 +41,13 @@ pub async fn query_user_stats<'a>(
None => 0,
};
// Return an error if the bearer is set, but the StatType is Detailed
if stat_response_type == StatType::Detailed && user_id == 0 {
return Err(Web3ProxyError::BadRequest(
"Detailed Stats Response requires you to authorize with a bearer token".to_owned(),
));
}
let db_replica = app
.db_replica()
.context("query_user_stats needs a db replica")?;