-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from wacker-dev/multipart
Add initial support for handling multipart/form-data body
- Loading branch information
Showing
11 changed files
with
457 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use serde::Deserialize; | ||
use std::time::Duration; | ||
use waki::Client; | ||
|
||
#[derive(Deserialize)] | ||
struct Data { | ||
data: String, | ||
} | ||
|
||
fn main() { | ||
let resp = Client::new() | ||
.post("https://httpbin.org/post") | ||
.body("hello") | ||
.connect_timeout(Duration::from_secs(5)) | ||
.send() | ||
.unwrap(); | ||
assert_eq!(resp.status_code(), 200); | ||
|
||
let data = resp.json::<Data>().unwrap(); | ||
assert_eq!(data.data, "hello"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub const MAX_HEADERS: usize = 32; | ||
pub const BOUNDARY_EXT: &str = "--"; | ||
pub const CRLF: &str = "\r\n"; | ||
pub const CRLF_CRLF: &str = "\r\n\r\n"; |
Oops, something went wrong.