check multiple posible stripe headers

This commit is contained in:
Bryan Stitt 2023-07-01 09:10:53 -07:00
parent ee626bfa61
commit 7044edc63c
2 changed files with 13 additions and 5 deletions

@ -101,11 +101,19 @@ pub async fn user_balance_stripe_post(
// ))?; // ))?;
// TODO Get this from the header // TODO Get this from the header
let signature = headers let signature = if let Some(x) = headers.get("stripe-signature") {
.get("STRIPE_SIGNATURE") x
.ok_or(Web3ProxyError::BadRequest( } else if let Some(x) = headers.get("STRIPE_SIGNATURE") {
x
} else if let Some(x) = headers.get("HTTP_STRIPE_SIGNATURE") {
x
} else {
return Err(Web3ProxyError::BadRequest(
"You have not provided a 'STRIPE_SIGNATURE' for the Stripe payload".into(), "You have not provided a 'STRIPE_SIGNATURE' for the Stripe payload".into(),
))? ));
};
let signature = signature
.to_str() .to_str()
.web3_context("Could not parse stripe signature as byte-string")?; .web3_context("Could not parse stripe signature as byte-string")?;

@ -10,7 +10,7 @@ use tokio::{
}; };
use web3_proxy::rpcs::blockchain::ArcBlock; use web3_proxy::rpcs::blockchain::ArcBlock;
#[cfg_attr(not(feature = "tests-needing-docker"), ignore)] // #[cfg_attr(not(feature = "tests-needing-docker"), ignore)]
#[ignore = "under construction"] #[ignore = "under construction"]
#[test_log::test(tokio::test)] #[test_log::test(tokio::test)]
async fn it_migrates_the_db() { async fn it_migrates_the_db() {