Skip to content

Commit

Permalink
fix verification
Browse files Browse the repository at this point in the history
  • Loading branch information
blind-oracle committed Jun 13, 2024
1 parent ae7036a commit bee95cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/routing/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::{
IcResponseStatus,
},
middleware::{self, request_id::RequestId},
CanisterId,
CanisterId, RequestCtx,
};

const MAX_REQUEST_BODY_SIZE: usize = 10 * 1_048_576;
Expand All @@ -32,6 +32,7 @@ pub async fn handler(
State(state): State<Arc<HandlerState>>,
canister_id: Option<Extension<CanisterId>>,
Extension(request_id): Extension<RequestId>,
Extension(ctx): Extension<Arc<RequestCtx>>,
request: Request,
) -> Result<Response, ErrorCause> {
let canister_id = canister_id
Expand Down Expand Up @@ -77,12 +78,14 @@ pub async fn handler(
});

// Execute the request
state
.client
.request(args)
//.unsafe_allow_skip_verification()
.send()
.await
let req = state.client.request(args);
let req = if !ctx.verify {
req.unsafe_allow_skip_verification()
} else {
req
};

req.send().await
})
.await
.map_err(ErrorCause::from_err)?;
Expand Down
2 changes: 1 addition & 1 deletion src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub fn setup_router(
let router = Router::new()
.nest("/api/v2", router_api)
.fallback(
|ctx: Extension<Arc<RequestCtx>>, request: Request| async move {
|Extension(ctx): Extension<Arc<RequestCtx>>, request: Request| async move {
let path = request.uri().path();

// If there are issuers defined and the request came to the base domain -> proxy to them
Expand Down

0 comments on commit bee95cb

Please sign in to comment.