Skip to content
Snippets Groups Projects
Commit 8c05e9c3 authored by codecraft's avatar codecraft :crocodile:
Browse files

rename `get_form_keys` to `get_get_form_keys`

parent 21a170df
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
use std::{collections::HashMap, error::Error, fmt::Display}; use std::{collections::HashMap, error::Error, fmt::Display};
use mime::Mime;
use super::{ use super::{
file_handlers::find_mimetype,
methods::Method, methods::Method,
routes::{Data, Uri}, routes::{Data, Uri},
}; };
...@@ -63,7 +66,10 @@ impl Request<'_> { ...@@ -63,7 +66,10 @@ impl Request<'_> {
_ => false, _ => false,
} }
} }
pub fn get_form_keys(&self, keys: Vec<&str>) -> Result<HashMap<&str, &str>, ParseFormError> { pub fn get_get_form_keys(
&self,
keys: Vec<&str>,
) -> Result<HashMap<&str, &str>, ParseFormError> {
let data = if let Some(val) = self.uri.split_once("?") { let data = if let Some(val) = self.uri.split_once("?") {
val val
} else { } else {
......
...@@ -21,7 +21,7 @@ fn hashmap_to_string(map: &HashMap<&str, &str>) -> String { ...@@ -21,7 +21,7 @@ fn hashmap_to_string(map: &HashMap<&str, &str>) -> String {
} }
fn handle_static_hi(request: Request<'_>, data: Data) -> Outcome<Response, Status, Data> { fn handle_static_hi(request: Request<'_>, data: Data) -> Outcome<Response, Status, Data> {
let keys = if let Ok(keys) = request.get_form_keys(vec!["asdf", "jkl;"]) { let keys = if let Ok(keys) = request.get_get_form_keys(vec!["asdf", "jkl;"]) {
keys keys
} else { } else {
return Outcome::Forward(data); return Outcome::Forward(data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment