Skip to content

Commit

Permalink
examples: bump waki version to 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed Jun 18, 2024
1 parent 6a95ec8 commit 710b04a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
adapter = "wasi_snapshot_preview1.command.wasm"

[dependencies]
waki = { version = "0.2.0", features = ["json"] }
waki = { version = "0.3.0", features = ["json", "multipart"] }
serde = { version = "1.0.202", features = ["derive"] }

# reduce wasm binary size
Expand Down
25 changes: 11 additions & 14 deletions examples/client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use serde::Deserialize;
use std::collections::HashMap;
use std::time::Duration;
use waki::Client;
use waki::{
multipart::{Form, Part},
Client,
};

#[derive(Debug, Deserialize)]
#[allow(dead_code)]
Expand Down Expand Up @@ -76,19 +79,13 @@ fn main() {
// post with file form data
let resp = Client::new()
.post("https://httpbin.org/post")
.header("Content-Type", "multipart/form-data; boundary=boundary")
.body(
"--boundary
Content-Disposition: form-data; name=field1
value1
--boundary
Content-Disposition: form-data; name=field2; filename=file.txt
Content-Type: text/plain
hello
--boundary--"
.as_bytes(),
.multipart(
Form::new().text("field1", "value1").part(
Part::new("field2", "hello")
.filename("file.txt")
.mime_str("text/plain")
.unwrap(),
),
)
.connect_timeout(Duration::from_secs(5))
.send()
Expand Down
2 changes: 1 addition & 1 deletion examples/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]
adapter = "wasi_snapshot_preview1.proxy.wasm"

[dependencies]
waki = "0.2.0"
waki = "0.3.0"

# reduce wasm binary size
[profile.release]
Expand Down

0 comments on commit 710b04a

Please sign in to comment.