Skip to content

Commit a064672

Browse files
authored
Merge branch 'develop' into bugfix/stackerdb-dkg-test
2 parents 38a14a9 + ad493ad commit a064672

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

stackslib/src/net/http/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl HttpRequestContents {
612612
}
613613

614614
/// Get a query argument
615-
pub fn get_query_arg(&self, key: &String) -> Option<&String> {
615+
pub fn get_query_arg(&self, key: &str) -> Option<&String> {
616616
self.query_args.get(key)
617617
}
618618

stackslib/src/net/httpcore.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,12 @@ impl HttpRequestContentsExtensions for HttpRequestContents {
329329

330330
/// Get the proof= query parameter value
331331
fn get_with_proof(&self) -> bool {
332-
let with_proof = if let Some(proof_val) = self.get_query_arg(&"proof".to_string()) {
333-
proof_val == "1"
334-
} else {
335-
false
336-
};
337-
338-
with_proof
332+
let proof_value = self
333+
.get_query_arg("proof")
334+
.map(|x| x.to_owned())
335+
// default to "with proof"
336+
.unwrap_or("1".into());
337+
&proof_value == "1"
339338
}
340339
}
341340

stackslib/src/net/tests/httpcore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ fn test_http_parse_proof_request_query() {
10121012
let proof_req = HttpRequestContents::new()
10131013
.query_string(Some(query_txt))
10141014
.get_with_proof();
1015-
assert!(!proof_req);
1015+
assert!(proof_req);
10161016

10171017
let query_txt = "proof=0";
10181018
let proof_req = HttpRequestContents::new()

0 commit comments

Comments
 (0)