Skip to content

Commit

Permalink
fix: fixed proxy api key (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan authored Nov 16, 2024
1 parent e16cf13 commit 9c0d2ed
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions proxy/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,12 @@ impl ProxyHttp for KupoProxy {
.get_header("host")
.map(|v| v.to_str().unwrap())
.unwrap();

let captures = self.host_regex.captures(host).unwrap();
let mut key = session
let key = session
.get_header(DMTR_API_KEY)
.map(|v| v.to_str().unwrap())
.and_then(|v| v.to_str().ok())
.or_else(|| captures.get(1).map(|v| v.as_str()))
.unwrap_or_default();
if let Some(m) = captures.get(1) {
key = m.as_str();
}

let consumer = state.get_consumer(key).await;
if consumer.is_none() {
Expand Down

0 comments on commit 9c0d2ed

Please sign in to comment.