Skip to content

Commit

Permalink
fix non-streaming outgoing POST requests in Rust SDK (#2083)
Browse files Browse the repository at this point in the history
This was my fault for over-simplifying the code in `spin_sdk::http::send`.  I've
added a test to make sure this stays fixed.

Fixed #2080

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
  • Loading branch information
dicej authored Nov 10, 2023
1 parent 2db5204 commit 40bbead
Show file tree
Hide file tree
Showing 11 changed files with 882 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ hyper = { workspace = true }
sha2 = "0.10.1"
which = "4.2.5"
e2e-testing = { path = "crates/e2e-testing" }
http-body-util = { workspace = true }

[build-dependencies]
cargo-target-dep = { git = "https://github.com/fermyon/cargo-target-dep", rev = "b7b1989fe0984c0f7c4966398304c6538e52fe49" }
Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const RUST_HTTP_VAULT_VARIABLES_TEST: &str = "tests/http/vault-variables-test";
const RUST_OUTBOUND_REDIS_INTEGRATION_TEST: &str = "tests/outbound-redis/http-rust-outbound-redis";
const TIMER_TRIGGER_INTEGRATION_TEST: &str = "examples/spin-timer/app-example";
const WASI_HTTP_INTEGRATION_TEST: &str = "examples/wasi-http-rust-streaming-outgoing-body";
const OUTBOUND_HTTP_POST_INTEGRATION_TEST: &str = "examples/http-rust-outbound-post";

fn main() {
// Extract environment information to be passed to plugins.
Expand Down Expand Up @@ -92,6 +93,7 @@ error: the `wasm32-wasi` target is not installed
cargo_build(RUST_OUTBOUND_REDIS_INTEGRATION_TEST);
cargo_build(TIMER_TRIGGER_INTEGRATION_TEST);
cargo_build(WASI_HTTP_INTEGRATION_TEST);
cargo_build(OUTBOUND_HTTP_POST_INTEGRATION_TEST);
}

fn build_wasm_test_program(name: &'static str, root: &'static str) {
Expand Down
2 changes: 2 additions & 0 deletions examples/http-rust-outbound-post/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-wasi"
Loading

0 comments on commit 40bbead

Please sign in to comment.