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

finishing the `get_post_data()` function for binary

Applicacation-x-www-urlencoded forms
parent d13f4659
No related branches found
No related tags found
1 merge request!1Initial feature merge
...@@ -145,7 +145,10 @@ impl Request<'_> { ...@@ -145,7 +145,10 @@ impl Request<'_> {
match post_type { match post_type {
Mime::ApplicationXWwwFormUrlencoded => { Mime::ApplicationXWwwFormUrlencoded => {
for kvp in data.split(|byte| *byte == b'&') { for kvp in data.split(|byte| *byte == b'&') {
let kvp = kvp.split(|byte| *byte == b'=').collect::<Vec<&[u8]>>(); let kvp = kvp
.split(|byte| *byte == b'=')
.map(|list| list.to_vec())
.collect::<Vec<Vec<u8>>>();
let key = if let Some(kv) = kvp.get(0) { let key = if let Some(kv) = kvp.get(0) {
kv kv
} else { } else {
...@@ -331,7 +334,7 @@ mod test { ...@@ -331,7 +334,7 @@ mod test {
method: crate::handling::methods::Method::Post, method: crate::handling::methods::Method::Post,
}; };
let data = Data { let data = Data {
buffer: b"message=23&message1=24".to_vec(), buffer: b"message=24&message1=23".to_vec(),
is_complete: true, is_complete: true,
}; };
assert_eq!( assert_eq!(
......
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