Skip to content

Commit

Permalink
spin: migrate to 2.0
Browse files Browse the repository at this point in the history
Some minor API tweaks were needed.
  • Loading branch information
psarna committed Nov 10, 2023
1 parent 667c330 commit 1f5072e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ base64 = "0.21.0"
num-traits = "0.2.15"
serde_json = "1.0.91"
worker = { version = "0.0.18", optional = true }
spin-sdk = { version = "2.0", git = "https://github.com/fermyon/spin", tag = "v2.0.0", default-features = false, optional = true }
spin-sdk = { version = "2.0", git = "https://github.com/fermyon/spin", tag = "v2.0.0", default-features = false, features = ["http"], optional = true }
sqlite3-parser = { version = "0.8.0", default-features = false, features = [ "YYNOERRORRECOVERY" ] }
http = { version = "0.2", optional = true }
bytes = { version = "1.4.0", optional = true }
Expand Down
6 changes: 2 additions & 4 deletions src/spin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ impl HttpClient {
.method("POST")
.body(Some(bytes::Bytes::copy_from_slice(body.as_bytes())))?;

let response = spin_sdk::outbound_http::send_request(req);
let resp: String =
std::str::from_utf8(&response?.into_body().unwrap_or_default())?.to_string();
let response: pipeline::ServerMsg = serde_json::from_str(&resp)?;
let response: http::Response<String> = spin_sdk::http::send(req).await?;
let response: pipeline::ServerMsg = serde_json::from_str(&response.into_body())?;
Ok(response)
}
}
Expand Down

0 comments on commit 1f5072e

Please sign in to comment.