Skip to content

Commit c1ec6d2

Browse files
authored
fix: fixed proxy api key (#40)
1 parent 2b89970 commit c1ec6d2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

proxy/src/proxy.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,12 @@ impl SubmitApiProxy {
8282
.unwrap();
8383

8484
let captures = self.host_regex.captures(host).unwrap();
85-
let mut key = session
85+
let key = session
8686
.get_header(DMTR_API_KEY)
87-
.map(|v| v.to_str().unwrap())
87+
.and_then(|v| v.to_str().ok())
88+
.or_else(|| captures.get(1).map(|v| v.as_str()))
8889
.unwrap_or_default();
89-
if let Some(m) = captures.get(1) {
90-
key = m.as_str();
91-
}
90+
9291
key.to_string()
9392
}
9493

0 commit comments

Comments
 (0)