File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -612,7 +612,7 @@ impl HttpRequestContents {
612
612
}
613
613
614
614
/// 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 > {
616
616
self . query_args . get ( key)
617
617
}
618
618
Original file line number Diff line number Diff line change @@ -329,13 +329,12 @@ impl HttpRequestContentsExtensions for HttpRequestContents {
329
329
330
330
/// Get the proof= query parameter value
331
331
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"
339
338
}
340
339
}
341
340
Original file line number Diff line number Diff line change @@ -1012,7 +1012,7 @@ fn test_http_parse_proof_request_query() {
1012
1012
let proof_req = HttpRequestContents :: new ( )
1013
1013
. query_string ( Some ( query_txt) )
1014
1014
. get_with_proof ( ) ;
1015
- assert ! ( ! proof_req) ;
1015
+ assert ! ( proof_req) ;
1016
1016
1017
1017
let query_txt = "proof=0" ;
1018
1018
let proof_req = HttpRequestContents :: new ( )
You can’t perform that action at this time.
0 commit comments