Skip to content

Commit

Permalink
fix(handlers): get params from route_info
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Oct 18, 2023
1 parent 9280436 commit 555da6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mime_guess = "2.0"
percent-encoding = "2.3"

hex = "0.4"
rust-embed = "6.8"
rust-embed = "8"

# OpenTelemetry
opentelemetry = { version = "0.20", default-features = false }
Expand Down
9 changes: 2 additions & 7 deletions viz-handlers/src/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use rust_embed::{EmbeddedFile, RustEmbed};
use viz_core::{
async_trait,
header::{HeaderMap, CONTENT_TYPE, ETAG, IF_NONE_MATCH},
types::Params,
Handler, IntoResponse, Method, Request, Response, Result, StatusCode,
Handler, IntoResponse, Method, Request, RequestExt, Response, Result, StatusCode,
};

/// Serve a single embedded file.
Expand Down Expand Up @@ -65,11 +64,7 @@ where
type Output = Result<Response>;

async fn call(&self, req: Request) -> Self::Output {
let path = match req
.extensions()
.get::<Params>()
.and_then(|params| params.first().map(|(_, v)| v))
{
let path = match req.route_info().params.first().map(|(_, v)| v) {
Some(p) => p,
None => "index.html",
};
Expand Down

0 comments on commit 555da6d

Please sign in to comment.