We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be1e735 commit e5578bbCopy full SHA for e5578bb
1 file changed
http/src/lib.rs
@@ -1,9 +1,9 @@
1
use extism_pdk::*;
2
3
#[plugin_fn]
4
-pub unsafe fn http_get(Json(input): Json<HttpRequest>) -> FnResult<Vec<u8>> {
+pub fn http_get(Json(input): Json<HttpRequest>) -> FnResult<Memory> {
5
let res = http::request::<()>(&input, None)?;
6
- let res = res.body();
+ let res = res.to_memory()?;
7
Ok(res)
8
}
9
@@ -15,8 +15,8 @@ struct HttpRequestWithBody {
15
16
17
18
-pub fn http_post(Json(input): Json<HttpRequestWithBody>) -> FnResult<Vec<u8>> {
+pub fn http_post(Json(input): Json<HttpRequestWithBody>) -> FnResult<Memory> {
19
let res = http::request::<&str>(&input.req, Some(&input.data))?;
20
+ let res = res.into_memory();
21
22
0 commit comments