diff --git a/httpserver/rust/Cargo.toml b/httpserver/rust/Cargo.toml index d4d0e1f..704c867 100644 --- a/httpserver/rust/Cargo.toml +++ b/httpserver/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-httpserver" -version = "0.8.2" +version = "0.9.0" description = "interface for actors to receive http requests (wasmcloud:httpserver)" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -20,7 +20,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] async-trait = "0.1" -serde = { version = "1.0" , features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" wasmbus-rpc = "0.11.1" diff --git a/httpserver/rust/src/lib.rs b/httpserver/rust/src/lib.rs index d69edb2..9fed122 100644 --- a/httpserver/rust/src/lib.rs +++ b/httpserver/rust/src/lib.rs @@ -38,14 +38,11 @@ impl HttpResponse { }) } - pub fn ok(response: S) -> Result - where - S: ToString, - { - Ok(HttpResponse { - body: response.to_string().as_bytes().to_vec(), + pub fn ok>>(response: S) -> HttpResponse { + HttpResponse { + body: response.into(), ..Default::default() - }) + } } /// Creates a response with a given status code, JSON-serialized payload, and headers specified by the header argument. Automatically includes the appropriate Content-Type header